[Scipy-svn] r4708 - in trunk: . tools tools/win32 tools/win32/build_scripts

scipy-svn@scip... scipy-svn@scip...
Tue Sep 9 12:11:24 CDT 2008


Author: cdavid
Date: 2008-09-09 12:11:12 -0500 (Tue, 09 Sep 2008)
New Revision: 4708

Added:
   trunk/tools/
   trunk/tools/win32/
   trunk/tools/win32/build_scripts/
   trunk/tools/win32/build_scripts/prepare_bootstrap.py
Log:
Start the prepare bootstrap for scipy.


Added: trunk/tools/win32/build_scripts/prepare_bootstrap.py
===================================================================
--- trunk/tools/win32/build_scripts/prepare_bootstrap.py	2008-09-09 14:16:57 UTC (rev 4707)
+++ trunk/tools/win32/build_scripts/prepare_bootstrap.py	2008-09-09 17:11:12 UTC (rev 4708)
@@ -0,0 +1,55 @@
+import os
+import subprocess
+from os.path import join as pjoin, split as psplit, dirname, exists as pexists
+import re
+
+def get_svn_version(chdir):
+    out = subprocess.Popen(['svn', 'info'], 
+                           stdout = subprocess.PIPE, cwd = chdir).communicate()[0]
+    r = re.compile('Revision: ([0-9]+)')
+    svnver = None
+    for line in out.split('\n'):
+        m = r.match(line)
+        if m:
+            svnver = m.group(1)
+
+    if not svnver:
+        raise ValueError("Error while parsing svn version ?")
+
+    return svnver
+
+def get_scipy_version(chdir):
+    version_file = pjoin(chdir, "scipy", "version.py")
+    if not pexists(version_file):
+        raise IOError("file %s not found" % version_file)
+
+    fid = open(version_file, "r")
+    vregex = re.compile("version\s*=\s*'(\d+)\.(\d+)\.(\d+)'")
+    isrelregex = re.compile("release\s*=\s*True")
+    isdevregex = re.compile("release\s*=\s*False")
+    isdev = None
+    version = None
+    for line in fid.readlines():
+        m = vregex.match(line)
+        if m:
+            version = [int(i) for i in m.groups()]
+        if isrelregex.match(line):
+            if isdev is None:
+                isdev = False
+            else:
+                raise RuntimeError("isdev already set ?")
+        if isdevregex.match(line):
+            if isdev is None:
+                isdev = True
+            else:
+                raise RuntimeError("isdev already set ?")
+            
+    verstr = ".".join([str(i) for i in version])
+    if isdev:
+        verstr += "dev"
+    return verstr
+
+if __name__ == '__main__':
+    ROOT = os.path.join("..", "..", "..")
+    print get_scipy_version(ROOT)
+    print get_svn_version(ROOT)



More information about the Scipy-svn mailing list