|
33 | 33 | # How to prepare the MinGW package: |
34 | 34 | # ============================================================================= |
35 | 35 | # |
36 | | -# * download and install MinGW using the latest mingw-get-inst-YYYYMMDD.exe |
37 | | -# (the default target installation directory is C:\MinGW) and install the |
38 | | -# C/C++/Fortran compilers |
39 | | -# * create WinPython MinGW32 directory %WINPYTHONBASEDIR%\tools.win32\mingw32 |
40 | | -# (where the WINPYTHONBASEDIR environment variable points to your WinPython |
41 | | -# base directory -- see function `make_winpython` below) |
42 | | -# * explore the target MinGW installation directory (default: C:\MinGW) |
43 | | -# * copy the `bin`, `doc`, `include`, `lib` and `libexec` folders from |
44 | | -# C:\MinGW to %WINPYTHONBASEDIR%\tools.win32\mingw32 (with MinGW 4.6.2, |
45 | | -# the overall size should be around 151 MB for 1435 files and 63 folders): |
46 | | -# * %WINPYTHONBASEDIR%\tools.win32\mingw32\bin |
47 | | -# * %WINPYTHONBASEDIR%\tools.win32\mingw32\doc |
48 | | -# * %WINPYTHONBASEDIR%\tools.win32\mingw32\include |
49 | | -# * %WINPYTHONBASEDIR%\tools.win32\mingw32\lib |
50 | | -# * %WINPYTHONBASEDIR%\tools.win32\mingw32\libexec |
51 | | - |
52 | | - |
53 | | -# ============================================================================= |
54 | | -# How to prepare the gettext package: |
55 | | -# ============================================================================= |
56 | | -# |
57 | | -# * download the latest gettext binaries for win32 (the latest should still be |
58 | | -# from 2005... anyway) |
59 | | -# * add the missing 'libiconv2.dll' by copying the 'libiconv-2.dll' from MinGW |
60 | | -# and renaming to 'libiconv2.dll' |
| 36 | +# go to https://github.com/numpy/numpy/wiki/Mingw-static-toolchain |
| 37 | +# for 32 bit, download mingw32static-2014-11.7z and unzip it |
| 38 | +# copy mingw32static-2014-11\mingw32static |
| 39 | +# to %WINPYTHONBASEDIR%\tools.win32\mingw32 |
| 40 | +# (so you have a %WINPYTHONBASEDIR%\tools.win32\mingw32\bin) |
| 41 | +# for 64 bit, download mingw64static-2014-11.7z and unzip it |
| 42 | +# copy mingw64static-2014-11\mingw32static |
| 43 | +# to %WINPYTHONBASEDIR%\tools.win-amd64\mingw32 |
| 44 | +# (so you have a %WINPYTHONBASEDIR%\tools.win-amd64\mingw32\bin) |
61 | 45 |
|
62 | 46 |
|
63 | 47 | def get_drives(): |
@@ -131,18 +115,15 @@ class WinPythonDistribution(object): |
131 | 115 | R_PATH = r'\tools\R\bin' |
132 | 116 | JULIA_PATH = r'\tools\Julia\bin' |
133 | 117 |
|
134 | | - def __init__(self, build_number, release_level, target, instdirs, |
135 | | - srcdirs=None, toolsdirs=None, verbose=False, simulation=False, |
| 118 | + def __init__(self, build_number, release_level, target, wheeldir, |
| 119 | + toolsdirs=None, verbose=False, simulation=False, |
136 | 120 | rootdir=None, install_options=None, flavor='', docsdirs=None): |
137 | 121 | assert isinstance(build_number, int) |
138 | 122 | assert isinstance(release_level, str) |
139 | 123 | self.build_number = build_number |
140 | 124 | self.release_level = release_level |
141 | 125 | self.target = target |
142 | | - self.instdirs = instdirs |
143 | | - self.srcdirs = srcdirs |
144 | | - if srcdirs is None: |
145 | | - self.srcdirs = [] |
| 126 | + self.wheeldir = wheeldir |
146 | 127 | if toolsdirs is None: |
147 | 128 | toolsdirs = [] |
148 | 129 | self._toolsdirs = toolsdirs |
@@ -294,12 +275,12 @@ def docsdirs(self): |
294 | 275 | return self._docsdirs |
295 | 276 |
|
296 | 277 | def get_package_fname(self, pattern): |
297 | | - """Get package matching pattern in instdirs""" |
298 | | - for path in (self.instdirs + self.srcdirs): |
299 | | - for fname in os.listdir(path): |
300 | | - match = re.match(pattern, fname) |
301 | | - if match is not None or pattern == fname: |
302 | | - return osp.abspath(osp.join(path, fname)) |
| 278 | + """Get package matching pattern in wheeldir""" |
| 279 | + path = self.wheeldir |
| 280 | + for fname in os.listdir(path): |
| 281 | + match = re.match(pattern, fname) |
| 282 | + if match is not None or pattern == fname: |
| 283 | + return osp.abspath(osp.join(path, fname)) |
303 | 284 | else: |
304 | 285 | raise RuntimeError( |
305 | 286 | 'Could not found required package matching %s' % pattern) |
@@ -444,8 +425,7 @@ def _check_packages(self): |
444 | 425 | print("Checking packages") |
445 | 426 | packages = [] |
446 | 427 | my_plist = [] |
447 | | - for m in (self.srcdirs + self.instdirs): |
448 | | - my_plist += os.listdir(m) |
| 428 | + my_plist += os.listdir(self.wheeldir) |
449 | 429 | for fname0 in my_plist: |
450 | 430 | fname = self.get_package_fname(fname0) |
451 | 431 | if fname == self.python_fname: |
@@ -490,11 +470,10 @@ def _install_required_packages(self): |
490 | 470 | '%s-([0-9\.]*[a-z\+]*[0-9]?)(.*)(\.exe|\.whl)' % happy_few) |
491 | 471 |
|
492 | 472 | def _install_all_other_packages(self): |
493 | | - """Try to install all other packages in instdirs""" |
| 473 | + """Try to install all other packages in wheeldir""" |
494 | 474 | print("Installing other packages") |
495 | 475 | my_list = [] |
496 | | - for m in (self.srcdirs + self.instdirs): |
497 | | - my_list += os.listdir(m) |
| 476 | + my_list += os.listdir(self.wheeldir) |
498 | 477 | for fname in my_list: |
499 | 478 | if osp.basename(fname) != osp.basename(self.python_fname): |
500 | 479 | try: |
@@ -922,7 +901,7 @@ def _create_batch_scripts(self): |
922 | 901 |
|
923 | 902 | def make(self, remove_existing=True): |
924 | 903 | """Make WinPython distribution in target directory from the installers |
925 | | - located in instdirs |
| 904 | + located in wheeldir |
926 | 905 |
|
927 | 906 | remove_existing=True: (default) install all from scratch |
928 | 907 | remove_existing=False: only for test purpose (launchers/scripts)""" |
@@ -1031,69 +1010,63 @@ def make_winpython(build_number, release_level, architecture, |
1031 | 1010 | assert architecture in (32, 64) |
1032 | 1011 | utils.print_box("Making WinPython %dbits" % architecture) |
1033 | 1012 | suffix = '.win32' if architecture == 32 else '.win-amd64' |
1034 | | - packdir1 = osp.join(basedir, 'packages' + suffix) |
1035 | | - assert osp.isdir(packdir1) |
1036 | | - packdirs = [packdir1] |
1037 | | - srcdir1 = osp.join(basedir, 'packages.src') |
1038 | | - assert osp.isdir(srcdir1) |
1039 | | - srcdirs = [srcdir1] |
1040 | | - # add flavor src and binary packages |
1041 | | - if flavor != '': |
1042 | | - packdir2 = osp.join(basedir, flavor, 'packages' + suffix) |
1043 | | - if osp.isdir(packdir2): |
1044 | | - packdirs.append(packdir2) |
1045 | | - srcdir2 = osp.join(basedir, flavor, 'packages.src') |
1046 | | - if osp.isdir(srcdir2): |
1047 | | - srcdirs.append(srcdir2) |
| 1013 | + |
| 1014 | + # Create Build director, where Winpython will be constructed |
1048 | 1015 | builddir = osp.join(basedir, 'build' + flavor) |
1049 | 1016 | if not osp.isdir(builddir): |
1050 | 1017 | os.mkdir(builddir) |
| 1018 | + |
| 1019 | + # Create 1 wheel directory to receive all packages whished for build |
| 1020 | + wheeldir = osp.join(builddir, 'wheels_tmp' + suffix) |
| 1021 | + if osp.isdir(wheeldir): |
| 1022 | + shutil.rmtree(wheeldir, onerror=utils.onerror) |
| 1023 | + os.mkdir(wheeldir) |
| 1024 | + # Copy Every package directory to the wheel directory |
| 1025 | + source_dirs = [osp.join(basedir, 'packages' + suffix), |
| 1026 | + osp.join(basedir, 'packages.src'), |
| 1027 | + osp.join(basedir, flavor, 'packages' + suffix), |
| 1028 | + osp.join(basedir, flavor, 'packages.src')] |
| 1029 | + for m in list(set(source_dirs)): |
| 1030 | + if osp.isdir(m): |
| 1031 | + src_files = os.listdir(m) |
| 1032 | + for file_name in src_files: |
| 1033 | + full_file_name = os.path.join(m, file_name) |
| 1034 | + shutil.copy(full_file_name, wheeldir) |
| 1035 | + |
| 1036 | + # Define List of Tools directory to collect |
1051 | 1037 | toolsdir1 = osp.join(basedir, 'tools') |
1052 | 1038 | assert osp.isdir(toolsdir1) |
1053 | 1039 | toolsdirs = [toolsdir1] |
1054 | 1040 | toolsdir2 = osp.join(basedir, 'tools' + suffix) |
1055 | 1041 | if osp.isdir(toolsdir2): |
1056 | 1042 | toolsdirs.append(toolsdir2) |
1057 | | - # add flavor tools in basedirxx\flavor\tools and tools+suffix |
| 1043 | + # add flavor tools |
1058 | 1044 | if flavor != '': |
1059 | 1045 | toolsdir3 = osp.join(basedir, flavor, 'tools') |
1060 | 1046 | toolsdir4 = osp.join(basedir, flavor, 'tools' + suffix) |
1061 | 1047 | for flavor_tools in [toolsdir3, toolsdir4]: |
1062 | 1048 | if osp.isdir(flavor_tools): |
1063 | 1049 | toolsdirs.append(flavor_tools) |
1064 | 1050 |
|
1065 | | - # create same for docs dirs as for tools dirs |
| 1051 | + # Define List of docs directory to collect |
1066 | 1052 | docsdir1 = osp.join(basedir, 'docs') |
1067 | 1053 | assert osp.isdir(docsdir1) |
1068 | 1054 | docsdirs = [docsdir1] |
1069 | 1055 | docsdir2 = osp.join(basedir, 'docs' + suffix) |
1070 | 1056 | if osp.isdir(docsdir2): |
1071 | 1057 | docsdirs.append(docsdir2) |
1072 | | - # add flavor tools in basedirxx\flavor\tools and tools+suffix |
| 1058 | + # add flavor docs |
1073 | 1059 | if flavor != '': |
1074 | 1060 | docsdir3 = osp.join(basedir, flavor, 'docs') |
1075 | 1061 | docsdir4 = osp.join(basedir, flavor, 'docs' + suffix) |
1076 | 1062 | for flavor_docs in [docsdir3, docsdir4]: |
1077 | 1063 | if osp.isdir(flavor_docs): |
1078 | 1064 | docsdirs.append(flavor_docs) |
1079 | 1065 |
|
1080 | | - # Every pack to 1 wheel directory |
1081 | | - wheeldir = osp.join(builddir, 'wheels_tmp' + suffix) |
1082 | | - if osp.isdir(wheeldir): |
1083 | | - shutil.rmtree(wheeldir, onerror=utils.onerror) |
1084 | | - os.mkdir(wheeldir) |
1085 | | - for m in (srcdirs + packdirs): |
1086 | | - src_files = os.listdir(m) |
1087 | | - for file_name in src_files: |
1088 | | - full_file_name = os.path.join(m, file_name) |
1089 | | - if (os.path.isfile(full_file_name)): |
1090 | | - shutil.copy(full_file_name, wheeldir) |
1091 | | - srcdirs2 = [wheeldir] |
1092 | | - packdirs2 = [ ] |
1093 | 1066 | install_options=['--no-index' , '--find-links=%s' % wheeldir] |
1094 | 1067 |
|
1095 | 1068 | dist = WinPythonDistribution(build_number, release_level, |
1096 | | - builddir, packdirs2, srcdirs2, toolsdirs, |
| 1069 | + builddir, wheeldir, toolsdirs, |
1097 | 1070 | verbose=verbose, simulation=simulation, |
1098 | 1071 | rootdir=rootdir, |
1099 | 1072 | install_options=install_options, |
|
0 commit comments