Skip to content

Commit 159014f

Browse files
authored
Merge pull request #277 from t20100/debian12
Added debian12 packaging
2 parents cab208c + 18474e0 commit 159014f

File tree

9 files changed

+52
-114
lines changed

9 files changed

+52
-114
lines changed

build-deb.sh

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Project: Silx
44
# https://github.com/silx-kit/silx
55
#
6-
# Copyright (C) 2015-2020 European Synchrotron Radiation Facility, Grenoble, France
6+
# Copyright (C) 2015-2023 European Synchrotron Radiation Facility, Grenoble, France
77
#
88
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
99
#
@@ -50,6 +50,9 @@ then
5050
bullseye)
5151
debian_version=11
5252
;;
53+
bookworm)
54+
debian_version=12
55+
;;
5356
esac
5457
fi
5558

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

66-
# Get version info
67-
cd ${project_directory}/src/${project}
68-
version=$(python3 -B -c"import _version; print(_version.version)")
69-
strictversion=$(python3 -B -c"import _version; print(_version.strictversion)")
70-
debianversion=$(python3 -B -c"import _version; print(_version.debianversion)")
7169
cd ${project_directory}
7270

71+
# Get version info
72+
version=$(python3 -c"import sys; sys.path.insert(0, './src/${project}'); import _version; print(_version.version)")
73+
strictversion=$(python3 -c"import sys; sys.path.insert(0, './src/${project}'); import _version; print(_version.strictversion)")
74+
debianversion=$(python3 -c"import sys; sys.path.insert(0, './src/${project}'); import _version; print(_version.debianversion)")
75+
7376
if [ -d /usr/lib/ccache ];
7477
then
7578
export PATH=/usr/lib/ccache:$PATH
@@ -91,6 +94,7 @@ optional arguments:
9194
--debian9 Simulate a debian 9 Stretch system
9295
--debian10 Simulate a debian 10 Buster system
9396
--debian11 Simulate a debian 11 Bullseye system
97+
--debian12 Simulate a debian 12 Bookworm system
9498
"
9599

96100
install=0
@@ -139,6 +143,13 @@ do
139143
build_directory=${project_directory}/build/${target_system}
140144
shift
141145
;;
146+
--debian12)
147+
debian_version=12
148+
target_system=debian${debian_version}
149+
dist_directory=${project_directory}/dist/${target_system}
150+
build_directory=${project_directory}/build/${target_system}
151+
shift
152+
;;
142153
-*)
143154
echo "Error: Unknown option: $1" >&2
144155
echo "$usage"
@@ -162,8 +173,8 @@ clean_up()
162173
build_deb() {
163174
tarname=${project}_${debianversion}.orig.tar.gz
164175
clean_up
165-
python3 setup.py debian_src
166-
cp -f dist/${tarname} ${build_directory}
176+
python3 setup.py sdist
177+
cp -f dist/${project}-${strictversion}.tar.gz ${build_directory}/${tarname}
167178
if [ -f dist/${project}-testimages.tar.gz ]
168179
then
169180
cp -f dist/${project}-testimages.tar.gz ${build_directory}

package/debian10/compat

Lines changed: 0 additions & 1 deletion
This file was deleted.

package/debian10/control

Lines changed: 0 additions & 38 deletions
This file was deleted.

package/debian12/control

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Source: hdf5plugin
2+
Maintainer: Thomas Vincent <thomas.vincent@esrf.fr>
3+
Section: python
4+
Priority: optional
5+
Build-Depends: debhelper-compat (= 12),
6+
dh-python,
7+
libgomp1,
8+
python3-all,
9+
python3-h5py,
10+
python3-setuptools,
11+
python3-wheel
12+
Standards-Version: 4.1.3
13+
Homepage: https://github.com/silx-kit/hdf5plugin
14+
15+
Package: python3-hdf5plugin
16+
Architecture: any
17+
Depends: ${misc:Depends}, ${python3:Depends}, ${shlibs:Depends}, python3-h5py, libgomp1
18+
Description: HDF5 Plugins for windows,MacOS and linux
19+
hdf5plugin
20+
==========
21+
.
22+
*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>`_.
23+
.
24+
* Supported operating systems: Linux, Windows, macOS.
25+
* Supported versions of Python: >= 3.7
26+
* Supported architectures: All.
27+
Specific optimizations are available for *x86* family and *ppc64le*.
28+
.
29+
*hdf5plugin* provides a generic way to enable the use of the provided HDF5 compression filters with `h5py`.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export HDF5PLUGIN_OPENMP=True
1111
export HDF5PLUGIN_CPP11=True
1212

1313
%:
14-
dh $@ --with python3 --buildsystem=pybuild
14+
dh $@ --buildsystem=pybuild
1515

1616
override_dh_auto_test:
1717
dh_auto_test -- -s custom --test-args="env PYTHONPATH={build_dir} {interpreter} -m hdf5plugin.test"

setup.py

Lines changed: 3 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import platform
3838
from setuptools import setup, Distribution, Extension
3939
from setuptools.command.build_ext import build_ext
40-
from setuptools.command.sdist import sdist
4140
from setuptools.command.build_py import build_py
4241
from setuptools.command.build_clib import build_clib
4342
try: # setuptools >= 62.4.0
@@ -1227,7 +1226,7 @@ def get_hdf5_dl_clib():
12271226

12281227
# setup
12291228

1230-
def get_version(debian=False):
1229+
def get_version():
12311230
"""Returns current version number from _version.py file"""
12321231
dirname = os.path.join(
12331232
os.path.dirname(os.path.abspath(__file__)), "src", PROJECT)
@@ -1237,69 +1236,7 @@ def get_version(debian=False):
12371236
import _version
12381237
sys.path = sys.path[1:]
12391238
sys.dont_write_bytecode = dont_write_bytecode
1240-
return _version.debianversion if debian else _version.strictversion
1241-
1242-
1243-
################################################################################
1244-
# Debian source tree
1245-
################################################################################
1246-
1247-
class sdist_debian(sdist):
1248-
"""
1249-
Tailor made sdist for debian
1250-
* remove auto-generated doc
1251-
* remove cython generated .c files
1252-
* remove cython generated .cpp files
1253-
* remove .bat files
1254-
* include .l man files
1255-
"""
1256-
1257-
description = "Create a source distribution for Debian (tarball, zip file, etc.)"
1258-
1259-
@staticmethod
1260-
def get_debian_name():
1261-
name = "%s_%s" % (PROJECT, get_version(debian=True))
1262-
return name
1263-
1264-
def prune_file_list(self):
1265-
sdist.prune_file_list(self)
1266-
to_remove = ["doc/build", "doc/pdf", "doc/html", "pylint", "epydoc"]
1267-
print("Removing files for debian")
1268-
for rm in to_remove:
1269-
self.filelist.exclude_pattern(pattern="*", anchor=False, prefix=rm)
1270-
1271-
# this is for Cython files specifically: remove C & html files
1272-
search_root = os.path.dirname(os.path.abspath(__file__))
1273-
for root, _, files in os.walk(search_root):
1274-
for afile in files:
1275-
if os.path.splitext(afile)[1].lower() == ".pyx":
1276-
base_file = os.path.join(root, afile)[len(search_root) + 1:-4]
1277-
self.filelist.exclude_pattern(pattern=base_file + ".c")
1278-
self.filelist.exclude_pattern(pattern=base_file + ".cpp")
1279-
self.filelist.exclude_pattern(pattern=base_file + ".html")
1280-
1281-
# do not include third_party/_local files
1282-
self.filelist.exclude_pattern(pattern="*", prefix="silx/third_party/_local")
1283-
1284-
def make_distribution(self):
1285-
self.prune_file_list()
1286-
sdist.make_distribution(self)
1287-
dest = self.archive_files[0]
1288-
dirname, basename = os.path.split(dest)
1289-
base, ext = os.path.splitext(basename)
1290-
while ext in [".zip", ".tar", ".bz2", ".gz", ".Z", ".lz", ".orig"]:
1291-
base, ext = os.path.splitext(base)
1292-
# if ext:
1293-
# dest = "".join((base, ext))
1294-
# else:
1295-
# dest = base
1296-
# sp = dest.split("-")
1297-
# base = sp[:-1]
1298-
# nr = sp[-1]
1299-
debian_arch = os.path.join(dirname, self.get_debian_name() + ".orig.tar.gz")
1300-
os.rename(self.archive_files[0], debian_arch)
1301-
self.archive_files = [debian_arch]
1302-
print("Building debian .orig.tar.gz in %s" % self.archive_files[0])
1239+
return _version.strictversion
13031240

13041241

13051242
PROJECT = 'hdf5plugin'
@@ -1333,7 +1270,7 @@ def make_distribution(self):
13331270
build_clib=BuildCLib,
13341271
build_ext=PluginBuildExt,
13351272
build_py=BuildPy,
1336-
debian_src=sdist_debian)
1273+
)
13371274

13381275

13391276
if __name__ == "__main__":

0 commit comments

Comments
 (0)