@@ -130,16 +130,18 @@ class WinPythonDistribution(object):
130130 WINMERGE_PATH = r'\tools\WinMerge\WinMergeU.exe'
131131 MINGW32_PATH = r'\tools\mingw32\bin'
132132
133- def __init__ (self , build_number , release_level , target , instdir ,
134- srcdir = None , toolsdirs = None , verbose = False , simulation = False ,
135- rootdir = None , install_options = None ):
133+ def __init__ (self , build_number , release_level , target , instdirs ,
134+ srcdirs = None , toolsdirs = None , verbose = False , simulation = False ,
135+ rootdir = None , install_options = None , flavor = '' ):
136136 assert isinstance (build_number , int )
137137 assert isinstance (release_level , str )
138138 self .build_number = build_number
139139 self .release_level = release_level
140140 self .target = target
141- self .instdir = instdir
142- self .srcdir = srcdir
141+ self .instdirs = instdirs
142+ self .srcdirs = srcdirs
143+ if srcdirs is None :
144+ self .srcdirs = []
143145 if toolsdirs is None :
144146 toolsdirs = []
145147 self ._toolsdirs = toolsdirs
@@ -154,6 +156,7 @@ def __init__(self, build_number, release_level, target, instdir,
154156 self .simulation = simulation
155157 self .rootdir = rootdir # addded to build from winpython
156158 self .install_options = install_options
159+ self .flavor = flavor
157160
158161 @property
159162 def package_index_wiki (self ):
@@ -192,7 +195,7 @@ def get_tool_path(relpath, checkfunc):
192195 python_desc = 'Python programming language with standard library'
193196 return """## WinPython %s
194197
195- The following packages are included in WinPython v%s.
198+ The following packages are included in WinPython v%s%s .
196199
197200### Tools
198201
@@ -205,7 +208,7 @@ def get_tool_path(relpath, checkfunc):
205208Name | Version | Description
206209-----|---------|------------
207210[Python](http://www.python.org/) | %s | %s
208- %s""" % (self .winpyver , self .winpyver , '\n ' .join (tools ),
211+ %s""" % (self .winpyver , self .winpyver , self . flavor , '\n ' .join (tools ),
209212 self .python_fullversion , python_desc , '\n ' .join (packages ))
210213
211214 @property
@@ -266,8 +269,8 @@ def toolsdirs(self):
266269 return [osp .join (osp .dirname (__file__ ), 'tools' )] + self ._toolsdirs
267270
268271 def get_package_fname (self , pattern ):
269- """Get package matching pattern in instdir """
270- for path in (self .instdir , self .srcdir ):
272+ """Get package matching pattern in instdirs """
273+ for path in (self .instdirs + self .srcdirs ):
271274 for fname in os .listdir (path ):
272275 match = re .match (pattern , fname )
273276 if match is not None :
@@ -369,8 +372,8 @@ def create_installer(self):
369372 fname = osp .join (portable_dir , 'installer-tmp.nsi' )
370373 data = (('DISTDIR' , self .winpydir ),
371374 ('ARCH' , self .winpy_arch ),
372- ('VERSION' , '%s.%d' % (self .python_fullversion ,
373- self .build_number )),
375+ ('VERSION' , '%s.%d%s ' % (self .python_fullversion ,
376+ self .build_number , self . flavor )),
374377 ('RELEASELEVEL' , self .release_level ),)
375378 build_nsis ('installer.nsi' , fname , data )
376379 self ._print_done ()
@@ -408,7 +411,10 @@ def _check_packages(self):
408411 """Check packages for duplicates or unsupported packages"""
409412 print ("Checking packages" )
410413 packages = []
411- for fname0 in os .listdir (self .srcdir ) + os .listdir (self .instdir ):
414+ my_plist = []
415+ for m in (self .srcdirs + self .instdirs ):
416+ my_plist += os .listdir (m )
417+ for fname0 in my_plist :
412418 fname = self .get_package_fname (fname0 )
413419 if fname == self .python_fname :
414420 continue
@@ -460,9 +466,12 @@ def _install_required_packages(self):
460466 % (happy_few , self .py_arch , self .python_version ))
461467
462468 def _install_all_other_packages (self ):
463- """Try to install all other packages in instdir """
469+ """Try to install all other packages in instdirs """
464470 print ("Installing other packages" )
465- for fname in os .listdir (self .srcdir ) + os .listdir (self .instdir ):
471+ my_list = []
472+ for m in (self .srcdirs + self .instdirs ):
473+ my_list += os .listdir (m )
474+ for fname in my_list :
466475 if osp .basename (fname ) != osp .basename (self .python_fname ):
467476 try :
468477 self .install_package (fname )
@@ -837,7 +846,7 @@ def _create_batch_scripts(self):
837846
838847 def make (self , remove_existing = True ):
839848 """Make WinPython distribution in target directory from the installers
840- located in instdir
849+ located in instdirs
841850
842851 remove_existing=True: (default) install all from scratch
843852 remove_existing=False: only for test purpose (launchers/scripts)"""
@@ -897,15 +906,16 @@ def make(self, remove_existing=True):
897906 # Writing package index
898907 self ._print ("Writing package index" )
899908 fname = osp .join (self .winpydir , os .pardir ,
900- 'WinPython-%s.txt' % self .winpyver )
909+ 'WinPython%s -%s.txt' % ( self .flavor , self . winpyver ) )
901910 open (fname , 'w' ).write (self .package_index_wiki )
902911 # Copy to winpython/changelogs
903912 shutil .copyfile (fname , osp .join (CHANGELOGS_DIR , osp .basename (fname )))
904913 self ._print_done ()
905914
906915 # Writing changelog
907916 self ._print ("Writing changelog" )
908- diff .write_changelog (self .winpyver , rootdir = self .rootdir )
917+ diff .write_changelog (self .winpyver , rootdir = self .rootdir ,
918+ flavor = self .flavor )
909919 self ._print_done ()
910920
911921
@@ -925,7 +935,7 @@ def rebuild_winpython(basedir=None, verbose=False, archis=(32, 64)):
925935def make_winpython (build_number , release_level , architecture ,
926936 basedir = None , verbose = False , remove_existing = True ,
927937 create_installer = True , simulation = False , rootdir = None ,
928- install_options = None ):
938+ install_options = None , flavor = '' ):
929939 """Make WinPython distribution, for a given base directory and
930940 architecture:
931941
@@ -944,11 +954,21 @@ def make_winpython(build_number, release_level, architecture,
944954 assert architecture in (32 , 64 )
945955 utils .print_box ("Making WinPython %dbits" % architecture )
946956 suffix = '.win32' if architecture == 32 else '.win-amd64'
947- packdir = osp .join (basedir , 'packages' + suffix )
948- assert osp .isdir (packdir )
949- srcdir = osp .join (basedir , 'packages.src' )
950- assert osp .isdir (srcdir )
951- builddir = osp .join (basedir , 'build' )
957+ packdir1 = osp .join (basedir , 'packages' + suffix )
958+ assert osp .isdir (packdir1 )
959+ packdirs = [packdir1 ]
960+ srcdir1 = osp .join (basedir , 'packages.src' )
961+ assert osp .isdir (srcdir1 )
962+ srcdirs = [srcdir1 ]
963+ # add flavor src and binary packages
964+ if flavor != '' :
965+ packdir2 = osp .join (basedir , flavor , 'packages' + suffix )
966+ if osp .isdir (packdir2 ):
967+ packdirs .append (packdir2 )
968+ srcdir2 = osp .join (basedir , flavor , 'packages.src' )
969+ if osp .isdir (srcdir2 ):
970+ srcdirs .append (srcdir2 )
971+ builddir = osp .join (basedir , 'build' + flavor )
952972 if not osp .isdir (builddir ):
953973 os .mkdir (builddir )
954974 toolsdir1 = osp .join (basedir , 'tools' )
@@ -957,11 +977,19 @@ def make_winpython(build_number, release_level, architecture,
957977 toolsdir2 = osp .join (basedir , 'tools' + suffix )
958978 if osp .isdir (toolsdir2 ):
959979 toolsdirs .append (toolsdir2 )
980+ # add flavor tools in basedirxx\flavor\tools and tools+suffix
981+ if flavor != '' :
982+ toolsdir3 = osp .join (basedir , flavor , 'tools' )
983+ toolsdir4 = osp .join (basedir , flavor , 'tools' + suffix )
984+ for flavor_tools in [toolsdir3 , toolsdir4 ]:
985+ if osp .isdir (flavor_tools ):
986+ toolsdirs .append (flavor_tools )
987+
960988 dist = WinPythonDistribution (build_number , release_level ,
961- builddir , packdir , srcdir , toolsdirs ,
989+ builddir , packdirs , srcdirs , toolsdirs ,
962990 verbose = verbose , simulation = simulation ,
963991 rootdir = rootdir ,
964- install_options = install_options )
992+ install_options = install_options , flavor = flavor )
965993 dist .make (remove_existing = remove_existing )
966994 if create_installer and not simulation :
967995 dist .create_installer ()
@@ -971,7 +999,7 @@ def make_winpython(build_number, release_level, architecture,
971999def make_all (build_number , release_level , pyver ,
9721000 rootdir = None , simulation = False , create_installer = True ,
9731001 verbose = False , remove_existing = True , archis = (32 , 64 ),
974- install_options = ['--no-deps' ]):
1002+ install_options = ['--no-deps' ], flavor = '' ):
9751003 """Make WinPython for both 32 and 64bit architectures:
9761004
9771005 make_all(build_number, release_level, pyver, rootdir, simulation=False,
@@ -988,7 +1016,8 @@ def make_all(build_number, release_level, pyver,
9881016 for architecture in archis :
9891017 make_winpython (build_number , release_level , architecture , basedir ,
9901018 verbose , remove_existing , create_installer , simulation ,
991- rootdir = rootdir , install_options = install_options )
1019+ rootdir = rootdir , install_options = install_options ,
1020+ flavor = flavor )
9921021
9931022
9941023if __name__ == '__main__' :
@@ -998,7 +1027,7 @@ def make_all(build_number, release_level, pyver,
9981027 #make_all(1, '', pyver='3.4', rootdir=r'D:\Winpython',
9991028 # verbose=False, archis=(32, ))
10001029 make_all (1 , '' , pyver = '3.4' , rootdir = r'D:\Winpython' ,
1001- verbose = False , archis = (64 , ))
1030+ verbose = False , archis = (64 , ), flavor = '' )
10021031 #make_all(2, '', pyver='3.3', rootdir=r'D:\Winpython',
10031032 # verbose=False, archis=(32, ))
10041033 #make_all(2, '', pyver='3.3', rootdir=r'D:\Winpython',
0 commit comments