[Python-checkins] cpython: Update prepare_ssl.py script to generate the .asm files.

zach.ware python-checkins at python.org
Thu Aug 7 06:21:44 CEST 2014


http://hg.python.org/cpython/rev/5e1f07b09dd7
changeset:   92031:5e1f07b09dd7
parent:      92029:09f56fdcacf1
user:        Zachary Ware <zachary.ware at gmail.com>
date:        Wed Aug 06 22:47:23 2014 -0500
summary:
  Update prepare_ssl.py script to generate the .asm files.

files:
  PCbuild/prepare_ssl.py |  39 +++++++++++++++++++++++------
  1 files changed, 31 insertions(+), 8 deletions(-)


diff --git a/PCbuild/prepare_ssl.py b/PCbuild/prepare_ssl.py
--- a/PCbuild/prepare_ssl.py
+++ b/PCbuild/prepare_ssl.py
@@ -81,6 +81,35 @@
                 fout.write(line)
     os.unlink(m32)
 
+def create_asms(makefile):
+    #create a custom makefile out of the provided one
+    asm_makefile = os.path.splitext(makefile)[0] + '.asm.mak'
+    with open(makefile) as fin:
+        with open(asm_makefile, 'w') as fout:
+            for line in fin:
+                # Keep everything up to the install target (it's convenient)
+                if line.startswith('install: all'):
+                    break
+                else:
+                    fout.write(line)
+            asms = []
+            for line in fin:
+                if '.asm' in line and line.strip().endswith('.pl'):
+                    asms.append(line.split(':')[0])
+                    while line.strip():
+                        fout.write(line)
+                        line = next(fin)
+                    fout.write('\n')
+
+            fout.write('asms: $(TMP_D) ')
+            fout.write(' '.join(asms))
+            fout.write('\n')
+
+    os.system('nmake /f {} PERL=perl asms'.format(asm_makefile))
+    os.unlink(asm_makefile)
+
+
+
 def fix_makefile(makefile):
     """Fix some stuff in all makefiles
     """
@@ -164,14 +193,8 @@
     else:
         print(makefile, 'already exists!')
 
-    # If the assembler files don't exist in tmpXX, copy them there
-    if os.path.exists("asm"+dirsuffix):
-        if not os.path.exists("tmp"+dirsuffix):
-            os.mkdir("tmp"+dirsuffix)
-        for f in os.listdir("asm"+dirsuffix):
-            if not f.endswith(".asm"): continue
-            if os.path.isfile(r"tmp%s\%s" % (dirsuffix, f)): continue
-            shutil.copy(r"asm%s\%s" % (dirsuffix, f), "tmp"+dirsuffix)
+    print('creating asms...')
+    create_asms(makefile)
 
 def main():
     if len(sys.argv) == 1:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list