Skip to content

Commit 388d9d5

Browse files
committed
Code refactoring + fixed/moved winpython/tests.py to ./test.py
1 parent c73a82e commit 388d9d5

File tree

4 files changed

+36
-34
lines changed

4 files changed

+36
-34
lines changed

make.py

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -645,17 +645,6 @@ def rebuild_winpython(basedir=None, verbose=False):
645645
architecture=architecture, verbose=verbose)
646646

647647

648-
ROOTDIR_DOC = """
649-
650-
The WinPython root directory (WINPYTHONROOTDIR environment variable which
651-
may be overriden with the `rootdir` option) contains the following folders:
652-
* (required) `packages.win32`: contains distutils 32-bit packages
653-
* (required) `packages.win-amd64`: contains distutils 64-bit packages
654-
* (optional) `packages.src`: contains distutils source distributions
655-
* (required) `tools`: contains architecture-independent tools
656-
* (optional) `tools.win32`: contains 32-bit-specific tools
657-
* (optional) `tools.win-amd64`: contains 64-bit-specific tools"""
658-
659648
def make_winpython(build_number, release_level, architecture,
660649
basedir=None, verbose=False, remove_existing=True,
661650
create_installer=True, simulation=False):
@@ -671,7 +660,7 @@ def make_winpython(build_number, release_level, architecture,
671660
`architecture`: [int] (32 or 64)
672661
`basedir`: [str] if None, WINPYTHONBASEDIR env var must be set
673662
(rootdir: root directory containing 'basedir27', 'basedir33', etc.)
674-
""" + ROOTDIR_DOC
663+
""" + utils.ROOTDIR_DOC
675664
basedir = basedir if basedir is not None else utils.BASE_DIR
676665
assert basedir is not None, "The *basedir* directory must be specified"
677666
assert architecture in (32, 64)
@@ -698,18 +687,6 @@ def make_winpython(build_number, release_level, architecture,
698687
dist.create_installer()
699688
return dist
700689

701-
def get_basedir(pyver, rootdir=None):
702-
"""Get basedir from Python version
703-
704-
`pyver`: Python version (X.Y format) [str]
705-
`rootdir`: [str] if None, WINPYTHONROOTDIR env var must be set
706-
(rootdir: root directory containing 'basedir27', 'basedir33', etc.)
707-
""" + ROOTDIR_DOC
708-
assert re.match(r'[0-9]+\.[0-9]+', pyver) is not None
709-
rootdir = rootdir if rootdir is not None else utils.ROOT_DIR
710-
assert rootdir is not None, "The *rootdir* directory must be specified"
711-
return osp.join(rootdir, 'basedir%s' % pyver[::2][:2])
712-
713690
def make_all(build_number, release_level, pyver,
714691
rootdir=None, simulation=False, create_installer=True,
715692
verbose=False, remove_existing=True):
@@ -723,21 +700,21 @@ def make_all(build_number, release_level, pyver,
723700
`pyver`: Python version (X.Y format) [str]
724701
`rootdir`: [str] if None, WINPYTHONROOTDIR env var must be set
725702
(rootdir: root directory containing 'basedir27', 'basedir33', etc.)
726-
""" + ROOTDIR_DOC
727-
basedir = get_basedir(pyver, rootdir=rootdir)
703+
""" + utils.ROOTDIR_DOC
704+
basedir = utils.get_basedir(pyver, rootdir=rootdir)
728705
rebuild_winpython(basedir=basedir)
729706
for architecture in (64, 32):
730707
make_winpython(build_number, release_level, architecture, basedir,
731708
verbose, remove_existing, create_installer, simulation)
732709

733710

734711
if __name__ == '__main__':
735-
make_all(3, '', pyver='3.3')#, create_installer=False)#, remove_existing=False, simulation=True)
736-
make_all(3, '', pyver='2.7')#, create_installer=False)#, remove_existing=False, simulation=True)
712+
make_all(0, '', pyver='3.3')#, create_installer=False)#, remove_existing=False, simulation=True)
713+
make_all(0, '', pyver='2.7')#, create_installer=False)#, remove_existing=False, simulation=True)
737714

738715
import upload
739716
import time
740-
for version in ("3.3.2.3", "2.7.5.3"):
717+
for version in ("3.3.3.0", "2.7.6.0"):
741718
for architecture in (64, 32):
742719
print(time.ctime())
743720
upload.upload_installer(version, architecture)

winpython/tests.py renamed to test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
from winpython import utils, wppm
2222

2323

24-
def test_python_packages():
24+
def test_python_packages(pyver):
2525
"""Check if all Python packages are supported by WinPython"""
26+
basedir = utils.get_basedir(pyver)
2627
for suffix in ('src', 'win32', 'win-amd64'):
27-
dirname = osp.join(utils.BASE_DIR, 'packages.%s' % suffix)
28+
dirname = osp.join(basedir, 'packages.%s' % suffix)
2829
for name in os.listdir(dirname):
2930
if osp.isfile(osp.join(dirname, name)) \
3031
and not re.match(r'python-([0-9\.]*)(\.amd64)?\.msi', name):
@@ -36,4 +37,5 @@ def test_python_packages():
3637

3738

3839
if __name__ == '__main__':
39-
test_python_packages()
40+
test_python_packages('2.7')
41+
test_python_packages('3.3')

winpython/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
WinPython License Agreement (MIT License)
44
-----------------------------------------
55
6-
Copyright (c) 2012 Pierre Raybaut
6+
Copyright (c) 2012-2013 Pierre Raybaut
77
88
Permission is hereby granted, free of charge, to any person
99
obtaining a copy of this software and associated documentation
@@ -27,7 +27,7 @@
2727
OTHER DEALINGS IN THE SOFTWARE.
2828
"""
2929

30-
__version__ = '0.17'
30+
__version__ = '0.18'
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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,29 @@
3636
ROOT_DIR = os.environ.get('WINPYTHONROOTDIR')
3737
BASE_DIR = os.environ.get('WINPYTHONBASEDIR')
3838

39+
ROOTDIR_DOC = """
40+
41+
The WinPython root directory (WINPYTHONROOTDIR environment variable which
42+
may be overriden with the `rootdir` option) contains the following folders:
43+
* (required) `packages.win32`: contains distutils 32-bit packages
44+
* (required) `packages.win-amd64`: contains distutils 64-bit packages
45+
* (optional) `packages.src`: contains distutils source distributions
46+
* (required) `tools`: contains architecture-independent tools
47+
* (optional) `tools.win32`: contains 32-bit-specific tools
48+
* (optional) `tools.win-amd64`: contains 64-bit-specific tools"""
49+
50+
def get_basedir(pyver, rootdir=None):
51+
"""Get basedir from Python version
52+
53+
`pyver`: Python version (X.Y format) [str]
54+
`rootdir`: [str] if None, WINPYTHONROOTDIR env var must be set
55+
(rootdir: root directory containing 'basedir27', 'basedir33', etc.)
56+
""" + ROOTDIR_DOC
57+
assert re.match(r'[0-9]+\.[0-9]+', pyver) is not None
58+
rootdir = rootdir if rootdir is not None else ROOT_DIR
59+
assert rootdir is not None, "The *rootdir* directory must be specified"
60+
return osp.join(rootdir, 'basedir%s' % pyver[::2][:2])
61+
3962

4063
def onerror(function, path, excinfo):
4164
"""Error handler for `shutil.rmtree`.

0 commit comments

Comments
 (0)