Skip to content

Commit 91519c9

Browse files
committed
make.py: make_all function now allows to build any Python 2.x or 3.x distro
with a single/simple command. It is recommended to set the WINPYTHONROOTDIR environment variable so that the `rootdir` option may be skipped.
1 parent aa372ef commit 91519c9

File tree

4 files changed

+46
-26
lines changed

4 files changed

+46
-26
lines changed

build_dist.bat

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,4 @@ rmdir /S /Q build
22
rmdir /S /Q dist
33
python setup.py build bdist_wininst --plat-name=win32
44
python setup.py build bdist_wininst --plat-name=win-amd64
5-
del %WINPYTHONBASEDIR%\packages.win32\winpython-*.exe
6-
del %WINPYTHONBASEDIR%\packages.win-amd64\winpython-*.exe
7-
move dist\winpython-*.win-amd64.exe %WINPYTHONBASEDIR%\packages.win-amd64
8-
move dist\winpython-*.win32.exe %WINPYTHONBASEDIR%\packages.win32
95
pause

make.py

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -594,21 +594,33 @@ def rebuild_winpython(basedir=None, verbose=False):
594594
architecture=architecture, verbose=verbose)
595595

596596

597-
def make_winpython(build_number, release_level, architecture,
598-
basedir=None, verbose=False, remove_existing=True,
599-
create_installer=True, simulation=False):
600-
"""Make WinPython distribution, assuming that the following folders exist
601-
in *basedir* directory (if basedir is None, the WINPYTHONBASEDIR environ-
602-
ment variable is assumed to be basedir):
603-
597+
ROOTDIR_DOC = """
598+
599+
The WinPython root directory (WINPYTHONROOTDIR environment variable which
600+
may be overriden with the `rootdir` option) contains the following folders:
604601
* (required) `packages.win32`: contains distutils 32-bit packages
605602
* (required) `packages.win-amd64`: contains distutils 64-bit packages
606603
* (optional) `packages.src`: contains distutils source distributions
607604
* (required) `tools`: contains architecture-independent tools
608605
* (optional) `tools.win32`: contains 32-bit-specific tools
609-
* (optional) `tools.win-amd64`: contains 64-bit-specific tools
606+
* (optional) `tools.win-amd64`: contains 64-bit-specific tools"""
607+
608+
def make_winpython(build_number, release_level, architecture,
609+
basedir=None, verbose=False, remove_existing=True,
610+
create_installer=True, simulation=False):
611+
"""Make WinPython distribution, for a given base directory and
612+
architecture:
613+
614+
make_winpython(build_number, release_level, architecture,
615+
basedir=None, verbose=False, remove_existing=True,
616+
create_installer=True, simulation=False)
610617
611-
architecture: integer (32 or 64)"""
618+
`build_number`: build number [int]
619+
`release_level`: release level (e.g. 'beta1', '') [str]
620+
`architecture`: [int] (32 or 64)
621+
`basedir`: [str] if None, WINPYTHONBASEDIR env var must be set
622+
(rootdir: root directory containing 'basedir27', 'basedir33', etc.)
623+
""" + ROOTDIR_DOC
612624
basedir = basedir if basedir is not None else utils.BASE_DIR
613625
assert basedir is not None, "The *basedir* directory must be specified"
614626
assert architecture in (32, 64)
@@ -635,19 +647,30 @@ def make_winpython(build_number, release_level, architecture,
635647
dist.create_installer()
636648
return dist
637649

638-
639-
def make_all(build_number, release_level, basedir=None, simulation=False,
640-
create_installer=True, verbose=False, remove_existing=True):
641-
"""Make WinPython for both 32 and 64bit architectures"""
650+
def make_all(build_number, release_level, pyver,
651+
rootdir=None, simulation=False, create_installer=True,
652+
verbose=False, remove_existing=True):
653+
"""Make WinPython for both 32 and 64bit architectures:
654+
655+
make_all(build_number, release_level, pyver, rootdir, simulation=False,
656+
create_installer=True, verbose=False, remove_existing=True)
657+
658+
`build_number`: build number [int]
659+
`release_level`: release level (e.g. 'beta1', '') [str]
660+
`pyver`: Python version (X.Y format) [str]
661+
`rootdir`: [str] if None, WINPYTHONROOTDIR env var must be set
662+
(rootdir: root directory containing 'basedir27', 'basedir33', etc.)
663+
""" + ROOTDIR_DOC
664+
assert re.match(r'[0-9]+\.[0-9]+', pyver) is not None
665+
rootdir = rootdir if rootdir is not None else utils.ROOT_DIR
666+
assert rootdir is not None, "The *rootdir* directory must be specified"
667+
basedir = osp.join(rootdir, 'basedir%s' % pyver[::2])
668+
rebuild_winpython(basedir=basedir)
642669
for architecture in (64, 32):
643-
make_winpython(build_number, release_level, architecture,
644-
basedir, verbose, remove_existing, create_installer,
645-
simulation)
670+
make_winpython(build_number, release_level, architecture, basedir,
671+
verbose, remove_existing, create_installer, simulation)
646672

647673

648674
if __name__ == '__main__':
649-
rebuild_winpython(basedir=r'D:\winpython\basedir33')
650-
# make_winpython(0, 'alpha1', 32, basedir=r'D:\winpython\basedir33',
651-
# create_installer=False)#, simulation=True)
652-
#remove_existing=False, create_installer=False)
653-
make_all(0, 'beta1', basedir=r'D:\winpython\basedir33')#, simulation=True)#, remove_existing=False, create_installer=False)
675+
# make_all(0, 'beta2', pyver='3.3')
676+
make_all(3, '', pyver='2.7')

winpython/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
OTHER DEALINGS IN THE SOFTWARE.
2828
"""
2929

30-
__version__ = '0.10'
30+
__version__ = '0.11'
3131
__license__ = __doc__
3232
__project_url__ = 'http://code.google.com/p/winpython'
3333
__forum_url__ = 'http://groups.google.com/group/winpython'

winpython/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
TOOLS_DIR = osp.abspath(osp.join(osp.dirname(__file__), os.pardir, 'tools'))
3232
if osp.isdir(TOOLS_DIR):
3333
os.environ['PATH'] += ';%s' % TOOLS_DIR
34+
ROOT_DIR = os.environ.get('WINPYTHONROOTDIR')
3435
BASE_DIR = os.environ.get('WINPYTHONBASEDIR')
3536

3637

0 commit comments

Comments
 (0)