Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > a33c9a1bfa1896d5c7dd2445d0d1ca0a > files > 2

python-tables-2.1.1-1mdv2009.0.src.rpm

--- setup.py.old	2008-03-10 16:17:45.000000000 -0400
+++ setup.py	2008-03-10 16:20:47.000000000 -0400
@@ -433,9 +433,17 @@
         'console_scripts': [
             'ptdump = tables.scripts.ptdump:main',
             'ptrepack = tables.scripts.ptrepack:main',
-            'nctoh5 = tables.netcdf3.scripts.nctoh5:main [netCDF]',
             ],
         }
+    # Create nctoh5 script only when ScientificPython is installed:
+    try:
+        import Scientific.IO.NetCDF
+    except ImportError:
+        pass
+    else:
+        setuptools_kwargs['entry_points']['console_scripts'].append(
+            'nctoh5 = tables.netcdf3.scripts.nctoh5:main [netCDF]'
+            )
     # Test suites.
     setuptools_kwargs['test_suite'] = 'tables.tests.test_all.suite'
     setuptools_kwargs['scripts'] = []
@@ -448,7 +456,15 @@
         'tables.tests', 'tables.numexpr.tests', 'tables.nodes.tests',
         'tables.netcdf3.tests', 'tables.nra.tests']
     setuptools_kwargs['scripts'] = [
-        'utils/ptdump', 'utils/ptrepack', 'utils/nctoh5']
+        'utils/ptdump', 'utils/ptrepack']
+    # Create nctoh5 script only when ScientificPython is installed:
+    try:
+        import Scientific.IO.NetCDF
+    except ImportError:
+        pass
+    else:
+        setuptools_kwargs['scripts'].append('utils/nctoh5')
+        
 # Copy additional data for packages that need it.
 setuptools_kwargs['package_data'] = {
     'tables.tests': ['*.h5'],