3737import platform
3838from setuptools import setup , Distribution , Extension
3939from setuptools .command .build_ext import build_ext
40- from setuptools .command .sdist import sdist
4140from setuptools .command .build_py import build_py
4241from setuptools .command .build_clib import build_clib
4342try : # 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
13051242PROJECT = '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
13391276if __name__ == "__main__" :
0 commit comments