Skip to content

Commit

Permalink
Merge pull request #277 from t20100/debian12
Browse files Browse the repository at this point in the history
Added debian12 packaging
  • Loading branch information
kif authored Sep 12, 2023
2 parents cab208c + 18474e0 commit 159014f
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 114 deletions.
27 changes: 19 additions & 8 deletions build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Project: Silx
# https://github.com/silx-kit/silx
#
# Copyright (C) 2015-2020 European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015-2023 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer ([email protected])
#
Expand Down Expand Up @@ -50,6 +50,9 @@ then
bullseye)
debian_version=11
;;
bookworm)
debian_version=12
;;
esac
fi

Expand All @@ -63,13 +66,13 @@ project_directory="`( cd \"$project_directory\" && pwd )`" # absolutized
dist_directory=${project_directory}/dist/${target_system}
build_directory=${project_directory}/build/${target_system}

# Get version info
cd ${project_directory}/src/${project}
version=$(python3 -B -c"import _version; print(_version.version)")
strictversion=$(python3 -B -c"import _version; print(_version.strictversion)")
debianversion=$(python3 -B -c"import _version; print(_version.debianversion)")
cd ${project_directory}

# Get version info
version=$(python3 -c"import sys; sys.path.insert(0, './src/${project}'); import _version; print(_version.version)")
strictversion=$(python3 -c"import sys; sys.path.insert(0, './src/${project}'); import _version; print(_version.strictversion)")
debianversion=$(python3 -c"import sys; sys.path.insert(0, './src/${project}'); import _version; print(_version.debianversion)")

if [ -d /usr/lib/ccache ];
then
export PATH=/usr/lib/ccache:$PATH
Expand All @@ -91,6 +94,7 @@ optional arguments:
--debian9 Simulate a debian 9 Stretch system
--debian10 Simulate a debian 10 Buster system
--debian11 Simulate a debian 11 Bullseye system
--debian12 Simulate a debian 12 Bookworm system
"

install=0
Expand Down Expand Up @@ -139,6 +143,13 @@ do
build_directory=${project_directory}/build/${target_system}
shift
;;
--debian12)
debian_version=12
target_system=debian${debian_version}
dist_directory=${project_directory}/dist/${target_system}
build_directory=${project_directory}/build/${target_system}
shift
;;
-*)
echo "Error: Unknown option: $1" >&2
echo "$usage"
Expand All @@ -162,8 +173,8 @@ clean_up()
build_deb() {
tarname=${project}_${debianversion}.orig.tar.gz
clean_up
python3 setup.py debian_src
cp -f dist/${tarname} ${build_directory}
python3 setup.py sdist
cp -f dist/${project}-${strictversion}.tar.gz ${build_directory}/${tarname}
if [ -f dist/${project}-testimages.tar.gz ]
then
cp -f dist/${project}-testimages.tar.gz ${build_directory}
Expand Down
1 change: 0 additions & 1 deletion package/debian10/compat

This file was deleted.

38 changes: 0 additions & 38 deletions package/debian10/control

This file was deleted.

File renamed without changes.
29 changes: 29 additions & 0 deletions package/debian12/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Source: hdf5plugin
Maintainer: Thomas Vincent <[email protected]>
Section: python
Priority: optional
Build-Depends: debhelper-compat (= 12),
dh-python,
libgomp1,
python3-all,
python3-h5py,
python3-setuptools,
python3-wheel
Standards-Version: 4.1.3
Homepage: https://github.com/silx-kit/hdf5plugin

Package: python3-hdf5plugin
Architecture: any
Depends: ${misc:Depends}, ${python3:Depends}, ${shlibs:Depends}, python3-h5py, libgomp1
Description: HDF5 Plugins for windows,MacOS and linux
hdf5plugin
==========
.
*hdf5plugin* provides `HDF5 compression filters <https://portal.hdfgroup.org/display/support/Registered+Filter+Plugins>`_ (namely: Blosc, Blosc2, BitShuffle, BZip2, FciDecomp, LZ4, SZ, SZ3, Zfp, ZStd) and makes them usable from `h5py <https://www.h5py.org>`_.
.
* Supported operating systems: Linux, Windows, macOS.
* Supported versions of Python: >= 3.7
* Supported architectures: All.
Specific optimizations are available for *x86* family and *ppc64le*.
.
*hdf5plugin* provides a generic way to enable the use of the provided HDF5 compression filters with `h5py`.
2 changes: 1 addition & 1 deletion package/debian10/rules → package/debian12/rules
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export HDF5PLUGIN_OPENMP=True
export HDF5PLUGIN_CPP11=True

%:
dh $@ --with python3 --buildsystem=pybuild
dh $@ --buildsystem=pybuild

override_dh_auto_test:
dh_auto_test -- -s custom --test-args="env PYTHONPATH={build_dir} {interpreter} -m hdf5plugin.test"
Expand Down
File renamed without changes.
File renamed without changes.
69 changes: 3 additions & 66 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import platform
from setuptools import setup, Distribution, Extension
from setuptools.command.build_ext import build_ext
from setuptools.command.sdist import sdist
from setuptools.command.build_py import build_py
from setuptools.command.build_clib import build_clib
try: # setuptools >= 62.4.0
Expand Down Expand Up @@ -1227,7 +1226,7 @@ def get_hdf5_dl_clib():

# setup

def get_version(debian=False):
def get_version():
"""Returns current version number from _version.py file"""
dirname = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "src", PROJECT)
Expand All @@ -1237,69 +1236,7 @@ def get_version(debian=False):
import _version
sys.path = sys.path[1:]
sys.dont_write_bytecode = dont_write_bytecode
return _version.debianversion if debian else _version.strictversion


################################################################################
# Debian source tree
################################################################################

class sdist_debian(sdist):
"""
Tailor made sdist for debian
* remove auto-generated doc
* remove cython generated .c files
* remove cython generated .cpp files
* remove .bat files
* include .l man files
"""

description = "Create a source distribution for Debian (tarball, zip file, etc.)"

@staticmethod
def get_debian_name():
name = "%s_%s" % (PROJECT, get_version(debian=True))
return name

def prune_file_list(self):
sdist.prune_file_list(self)
to_remove = ["doc/build", "doc/pdf", "doc/html", "pylint", "epydoc"]
print("Removing files for debian")
for rm in to_remove:
self.filelist.exclude_pattern(pattern="*", anchor=False, prefix=rm)

# this is for Cython files specifically: remove C & html files
search_root = os.path.dirname(os.path.abspath(__file__))
for root, _, files in os.walk(search_root):
for afile in files:
if os.path.splitext(afile)[1].lower() == ".pyx":
base_file = os.path.join(root, afile)[len(search_root) + 1:-4]
self.filelist.exclude_pattern(pattern=base_file + ".c")
self.filelist.exclude_pattern(pattern=base_file + ".cpp")
self.filelist.exclude_pattern(pattern=base_file + ".html")

# do not include third_party/_local files
self.filelist.exclude_pattern(pattern="*", prefix="silx/third_party/_local")

def make_distribution(self):
self.prune_file_list()
sdist.make_distribution(self)
dest = self.archive_files[0]
dirname, basename = os.path.split(dest)
base, ext = os.path.splitext(basename)
while ext in [".zip", ".tar", ".bz2", ".gz", ".Z", ".lz", ".orig"]:
base, ext = os.path.splitext(base)
# if ext:
# dest = "".join((base, ext))
# else:
# dest = base
# sp = dest.split("-")
# base = sp[:-1]
# nr = sp[-1]
debian_arch = os.path.join(dirname, self.get_debian_name() + ".orig.tar.gz")
os.rename(self.archive_files[0], debian_arch)
self.archive_files = [debian_arch]
print("Building debian .orig.tar.gz in %s" % self.archive_files[0])
return _version.strictversion


PROJECT = 'hdf5plugin'
Expand Down Expand Up @@ -1333,7 +1270,7 @@ def make_distribution(self):
build_clib=BuildCLib,
build_ext=PluginBuildExt,
build_py=BuildPy,
debian_src=sdist_debian)
)


if __name__ == "__main__":
Expand Down

0 comments on commit 159014f

Please sign in to comment.