From 6facfd27a16717d4ec443b01b7efc48a4b36af88 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Sat, 1 Sep 2012 10:25:17 -0400 Subject: [PATCH 1/3] BUG: Bento version must end with number --- bento.info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bento.info b/bento.info index 2f32afd4..a23e83f0 100644 --- a/bento.info +++ b/bento.info @@ -1,5 +1,5 @@ Name: scikits-image -Version: 0.7.0.dev +Version: 0.7.0.dev0 Summary: Image processing routines for SciPy Url: http://scikits-image.org DownloadUrl: http://github.com/scikits-image/scikits-image From 2314cfd8d6c42fd6f374a27140031b19001fbb9e Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Sat, 1 Sep 2012 10:32:29 -0400 Subject: [PATCH 2/3] ENH: Add script to check that bento.info is up-to-date. --- check_bento_build.py | 95 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 check_bento_build.py diff --git a/check_bento_build.py b/check_bento_build.py new file mode 100644 index 00000000..d085b3ba --- /dev/null +++ b/check_bento_build.py @@ -0,0 +1,95 @@ +""" +Check that Cython extensions in setup.py files match those in bento.info. +""" +import os +import re + + +RE_CYTHON = re.compile("config.add_extension\(['\"]([\S]+)['\"]") + +BENTO_TEMPLATE = """ + Extension: {module_path} + Sources: + {dir_path}.pyx""" + + +def each_setup_in_pkg(top_dir): + """Yield path and file object for each setup.py file""" + for dir_path, dir_names, filenames in os.walk(top_dir): + for fname in filenames: + if fname == 'setup.py': + with open(os.path.join(dir_path, 'setup.py')) as f: + yield dir_path, f + + +def each_cy_in_setup(top_dir): + """Yield path and name for each cython extension package's setup file.""" + for dir_path, f in each_setup_in_pkg(top_dir): + text = f.read() + match = RE_CYTHON.findall(text) + if match: + for cy_file in match: + # if cython files in different directory than setup.py + if '.' in cy_file: + parts = cy_file.split('.') + cy_file = parts[-1] + # Don't overwrite dir_path for subsequent iterations. + path = os.path.join(dir_path, *parts[:-1]) + else: + path = dir_path + full_path = os.path.join(path, cy_file) + yield full_path, cy_file + + +def each_cy_in_bento(bento_file='bento.info'): + """Yield path and name for each cython extension in bento info file.""" + with open(bento_file) as f: + for line in f: + line = line.strip() + if line.startswith('Extension:'): + parts = line.split('.') + ext_name = parts[-1] + path = line.lstrip('Extension:').strip() + yield path, ext_name + + +def remove_common_extensions(cy_bento, cy_setup): + for ext_name in cy_bento.keys(): + if ext_name in cy_setup: + spath = cy_setup.pop(ext_name) + bpath = cy_bento.pop(ext_name) + if not spath.replace(os.path.sep, '.') == bpath: + print "Mismatched paths:" + print " setup.py: ", spath + print " bento.info:", bpath + +def print_results(cy_bento, cy_setup): + def info(text): + print + print(text) + print('-' * len(text)) + + print # blank line; just for aesthetics + + if cy_bento: + info("The following extensions in 'bento.info' were not found:") + print('\n'.join(cy_bento.keys())) + + + if cy_setup: + info("The following cython files exist but were not in 'bento.info':") + print('\n'.join(cy_setup)) + info("Consider adding the following to the 'bento.info' Library:") + for ext_name, dir_path in cy_setup.iteritems(): + print BENTO_TEMPLATE.format(module_path=dir_path.replace('/', '.'), + dir_path=dir_path) + +if __name__ == '__main__': + # All cython extensions defined in 'setup.py' files. + cy_setup = dict((ext, path) for path, ext in each_cy_in_setup('skimage')) + + # All cython extensions defined 'bento.info' file. + cy_bento = dict((ext, path) for path, ext in each_cy_in_bento()) + + remove_common_extensions(cy_bento, cy_setup) + print_results(cy_bento, cy_setup) From ed05b8874015bbe504453b21d7dcf688852de387 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Sat, 1 Sep 2012 10:52:15 -0400 Subject: [PATCH 3/3] BUG: Update bento.info to match setup.py files --- bento.info | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/bento.info b/bento.info index a23e83f0..4365cf04 100644 --- a/bento.info +++ b/bento.info @@ -40,9 +40,6 @@ Library: Extension: skimage.morphology._pnpoly Sources: skimage/morphology/_pnpoly.pyx - Extension: skimage.feature._greycomatrix - Sources: - skimage/feature/_greycomatrix.pyx Extension: skimage.feature._template Sources: skimage/feature/_template.pyx @@ -76,15 +73,9 @@ Library: Extension: skimage.morphology._convex_hull Sources: skimage/morphology/_convex_hull.pyx - Extension: skimage.morphology._skeletonize - Sources: - skimage/morphology/_skeletonize.pyx Extension: skimage.draw._draw Sources: skimage/draw/_draw.pyx - Extension: skimage.transform._project - Sources: - skimage/transform/_project.pyx Extension: skimage.graph._spath Sources: skimage/graph/_spath.pyx @@ -94,6 +85,36 @@ Library: Extension: skimage.graph.heap Sources: skimage/graph/heap.pyx + Extension: skimage.morphology._greyreconstruct + Sources: + skimage/morphology/_greyreconstruct.pyx + Extension: skimage.feature._texture + Sources: + skimage/feature/_texture.pyx + Extension: skimage._shared.transform + Sources: + skimage/_shared/transform.pyx + Extension: skimage.segmentation._slic + Sources: + skimage/segmentation/_slic.pyx + Extension: skimage.segmentation._quickshift + Sources: + skimage/segmentation/_quickshift.pyx + Extension: skimage.morphology._skeletonize_cy + Sources: + skimage/morphology/_skeletonize_cy.pyx + Extension: skimage.transform._warps_cy + Sources: + skimage/transform/_warps_cy.pyx + Extension: skimage._shared.interpolation + Sources: + skimage/_shared/interpolation.pyx + Extension: skimage.segmentation._felzenszwalb_cy + Sources: + skimage/segmentation/_felzenszwalb_cy.pyx + Extension: skimage._shared.geometry + Sources: + skimage/_shared/geometry.pyx Executable: skivi Module: skimage.scripts.skivi