[Numpy-svn] r3660 - in trunk/numpy: . distutils f2py

numpy-svn@scip... numpy-svn@scip...
Wed Apr 4 12:25:30 CDT 2007


Author: rkern
Date: 2007-04-04 12:25:29 -0500 (Wed, 04 Apr 2007)
New Revision: 3660

Modified:
   trunk/numpy/distutils/misc_util.py
   trunk/numpy/f2py/__version__.py
   trunk/numpy/version.py
Log:
Fix #491

Modified: trunk/numpy/distutils/misc_util.py
===================================================================
--- trunk/numpy/distutils/misc_util.py	2007-04-04 16:11:49 UTC (rev 3659)
+++ trunk/numpy/distutils/misc_util.py	2007-04-04 17:25:29 UTC (rev 3660)
@@ -1312,31 +1312,31 @@
         If __svn_version__.py existed before, nothing is done.
         """
         target = njoin(self.local_path,'__svn_version__.py')
-        if os.path.isfile(target):
+        revision = self._get_svn_revision(self.local_path)
+        if os.path.isfile(target) or revision is None:
             return
-        def generate_svn_version_py():
-            if not os.path.isfile(target):
-                revision = self._get_svn_revision(self.local_path)
-                assert revision is not None,'hmm, why I am not inside SVN tree???'
-                version = str(revision)
-                self.info('Creating %s (version=%r)' % (target,version))
-                f = open(target,'w')
-                f.write('version = %r\n' % (version))
-                f.close()
+        else:
+            def generate_svn_version_py():
+                if not os.path.isfile(target):
+                    version = str(revision)
+                    self.info('Creating %s (version=%r)' % (target,version))
+                    f = open(target,'w')
+                    f.write('version = %r\n' % (version))
+                    f.close()
 
-            import atexit
-            def rm_file(f=target,p=self.info):
-                if delete:
-                    try: os.remove(f); p('removed '+f)
-                    except OSError: pass
-                    try: os.remove(f+'c'); p('removed '+f+'c')
-                    except OSError: pass
+                import atexit
+                def rm_file(f=target,p=self.info):
+                    if delete:
+                        try: os.remove(f); p('removed '+f)
+                        except OSError: pass
+                        try: os.remove(f+'c'); p('removed '+f+'c')
+                        except OSError: pass
 
-            atexit.register(rm_file)
+                atexit.register(rm_file)
 
-            return target
+                return target
 
-        self.add_data_files(('', generate_svn_version_py()))
+            self.add_data_files(('', generate_svn_version_py()))
 
     def make_config_py(self,name='__config__'):
         """ Generate package __config__.py file containing system_info

Modified: trunk/numpy/f2py/__version__.py
===================================================================
--- trunk/numpy/f2py/__version__.py	2007-04-04 16:11:49 UTC (rev 3659)
+++ trunk/numpy/f2py/__version__.py	2007-04-04 17:25:29 UTC (rev 3660)
@@ -2,8 +2,7 @@
 
 try:
     from __svn_version__ import version
-    version_info = (major,version)
+    version_info = (major, version)
     version = '%s_%s' % version_info
-except Exception,msg:
-    print msg
-    version = '%s_?' % (major)
+except ImportError:
+    version = str(major)

Modified: trunk/numpy/version.py
===================================================================
--- trunk/numpy/version.py	2007-04-04 16:11:49 UTC (rev 3659)
+++ trunk/numpy/version.py	2007-04-04 17:25:29 UTC (rev 3660)
@@ -2,6 +2,7 @@
 release=False
 
 if not release:
+    version += '.dev'
     import os
     svn_version_file = os.path.join(os.path.dirname(__file__),
                                    'core','__svn_version__.py')
@@ -11,4 +12,4 @@
                               open(svn_version_file),
                               svn_version_file,
                               ('.py','U',1))
-        version += '.dev'+svn.version
+        version += svn.version



More information about the Numpy-svn mailing list