[pypy-commit] pypy default: refactor "os import" in make_portable.py to make it importable on windows

mattip pypy.commits at gmail.com
Sun Nov 3 06:13:41 EST 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r97942:9f7ce234ad3a
Date: 2019-11-02 05:58 -0400
http://bitbucket.org/pypy/pypy/changeset/9f7ce234ad3a/

Log:	refactor "os import" in make_portable.py to make it importable on
	windows

diff --git a/pypy/tool/release/make_portable.py b/pypy/tool/release/make_portable.py
--- a/pypy/tool/release/make_portable.py
+++ b/pypy/tool/release/make_portable.py
@@ -3,7 +3,7 @@
 bundle = ['sqlite3', 'ssl', 'crypto', 'ffi', 'expat', 'tcl', 'tk', 'gdbm',
           'lzma', 'tinfo', 'tinfow', 'ncursesw', 'panelw', 'ncurses', 'panel', 'panelw']
 
-from os import chdir, mkdir, symlink
+import os
 from os.path import dirname, relpath, join, exists, basename, realpath
 from shutil import copy2
 import sys
@@ -53,7 +53,7 @@
         copied[path] = 'lib/' + bname
 
         if not exists('lib/' + needed):
-            symlink(bname, 'lib/' + needed)
+            os.symlink(bname, 'lib/' + needed)
 
     return copied
 
@@ -96,13 +96,13 @@
 
 if __name__ == '__main__':
     try:
-        chdir(sys.argv[1])
+        os.chdir(sys.argv[1])
     except:
         print('Call as %s <path/to/pypy/topdir' % sys.argv[0])
         exit(-1)
 
     try:
-        mkdir('lib')
+        os.mkdir('lib')
     except OSError:
         pass
 


More information about the pypy-commit mailing list