Skip to content

Commit

Permalink
Merge pull request winpython#37 from stonebig/master
Browse files Browse the repository at this point in the history
A complete tour of wheel
  • Loading branch information
stonebig committed Jan 10, 2015
2 parents c83549a + f4d0e7d commit 5c38bb7
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
12 changes: 6 additions & 6 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,10 +1009,10 @@ def rebuild_winpython(basedir=None, verbose=False, archis=(32, 64)):
suffix = '.win32' if architecture == 32 else '.win-amd64'
packdir = osp.join(basedir, 'packages' + suffix)
for name in os.listdir(packdir):
if name.startswith('winpython-') and name.endswith('.exe'):
if name.startswith('winpython-') and name.endswith(('.exe', '.whl')):
os.remove(osp.join(packdir, name))
utils.build_wininst(osp.dirname(osp.abspath(__file__)), copy_to=packdir,
architecture=architecture, verbose=verbose)
architecture=architecture, verbose=verbose, installer='bdist_wheel')


def make_winpython(build_number, release_level, architecture,
Expand Down Expand Up @@ -1132,8 +1132,8 @@ def make_all(build_number, release_level, pyver,
# verbose=False, archis=(32, ))
#make_all(5, '', pyver='3.3', rootdir=r'D:\Winpython',
# verbose=False, archis=(64, ))
#make_all(2, '', pyver='2.7', rootdir=r'D:\Winpython',
# verbose=False, archis=(32, ))
make_all(2, '', pyver='2.7', rootdir=r'D:\Winpython',
verbose=False, archis=(32, ))
#make_all(2, '', pyver='2.7', rootdir=r'D:\Winpython',
# verbose=False, archis=(64, ))
#make_all(2, '', pyver='2.7', rootdir=r'D:\Winpython',
Expand All @@ -1142,7 +1142,7 @@ def make_all(build_number, release_level, pyver,
# verbose=False, archis=(64, ), flavor='FlavorIgraph')
#make_all(4, '', pyver='3.4', rootdir=r'D:\Winpython',
# verbose=False, archis=(32, ), flavor='FlavorKivy')
make_all(4, '', pyver='3.4', rootdir=r'D:\Winpython',
verbose=False, archis=(32, ), flavor='FlavorRfull')
#make_all(4, '', pyver='3.4', rootdir=r'D:\Winpython',
# verbose=False, archis=(32, ), flavor='FlavorRfull')
#make_all(4, '', pyver='3.4', rootdir=r'D:\Winpython',
# verbose=False, archis=(64, ), flavor='FlavorRfull')
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
The WinPython distribution tools (wppm, ...)
"""

# for wheels creation
import setuptools
try:
from wheel.bdist_wheel import bdist_wheel
except ImportError:
pass


from distutils.core import setup
import os
import os.path as osp
Expand Down
2 changes: 1 addition & 1 deletion winpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
OTHER DEALINGS IN THE SOFTWARE.
"""

__version__ = '1.0'
__version__ = '1.1'
__license__ = __doc__
__project_url__ = 'http://winpython.github.io/'
16 changes: 12 additions & 4 deletions winpython/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def extract_archive(fname, targetdir=None, verbose=False):
# . joblib-0.8.3_r1-py2.py3-none-any.whl,
# . joblib-0.8.3-r1.tar.gz

SOURCE_PATTERN = r'([a-zA-Z0-9\-\_\.]*)-([0-9\.\_]*[a-z]*[0-9]?)(\.zip|\.tar\.gz|\-[a-z\.0-9]*\-none\-any\.whl)'
SOURCE_PATTERN = r'([a-zA-Z0-9\-\_\.]*)-([0-9\.\_]*[a-z]*[0-9]?)(\.zip|\.tar\.gz|\-(py2|py2\.py3|py3)\-none\-any\.whl)'

# WHEELBIN_PATTERN defines what an acceptable binary wheel package is
# "cp([0-9]*)" to replace per cp(34) for python3.4
Expand All @@ -369,7 +369,7 @@ def get_source_package_infos(fname):


def build_wininst(root, python_exe=None, copy_to=None,
architecture=None, verbose=False):
architecture=None, verbose=False, installer='bdist_wininst'):
"""Build wininst installer from Python package located in *root*
and eventually copy it to *copy_to* folder.
Return wininst installer full path."""
Expand All @@ -380,7 +380,7 @@ def build_wininst(root, python_exe=None, copy_to=None,
if architecture is not None:
archstr = 'win32' if architecture == 32 else 'win-amd64'
cmd += ['--plat-name=%s' % archstr]
cmd += ['bdist_wininst']
cmd += [installer]
# root = a tmp dir in windows\tmp,
if verbose:
subprocess.call(cmd, cwd=root)
Expand All @@ -404,8 +404,16 @@ def build_wininst(root, python_exe=None, copy_to=None,
match = re.match(pattern, distname)
if match is not None:
break
# for wheels (winpython here)
match = re.match(SOURCE_PATTERN, distname)
if match is not None:
break
match = re.match(WHEELBIN_PATTERN, distname)
if match is not None:
break
else:
raise RuntimeError("Build failed: not a pure Python package?")
raise RuntimeError("Build failed: not a pure Python package? %s" %
distdir)
src_fname = osp.join(distdir, distname)
if copy_to is None:
return src_fname
Expand Down

0 comments on commit 5c38bb7

Please sign in to comment.