~pygame/pygame/trunk

« back to all changes in this revision

Viewing changes to .travis_osx_rename_whl.py

  • Committer: pygame
  • Date: 2017-01-10 00:31:42 UTC
  • Revision ID: git-v1:2eea4f299a2e791f884608d7ed601558634af73c
commit 1639c41a8cb3433046882ede92c80ce69d59016b
Author: Thomas Kluyver <takowl@gmail.com>
Date:   Sun Jan 8 18:46:46 2017 +0000

    Build newer versions of libogg and libvorbis into Linux base images

    Closes #317
    Closes #323

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""Rename the wheel so that pip will find it for more Pythons.
 
2
 
 
3
Python.org builds and Mac system Python are built as 'fat' binaries, including
 
4
both x86 (32 bit) and x86_64 (64 bit) executable code in one file. On these
 
5
Pythons, pip will look for wheels with fat libraries, tagged 'intel'. However,
 
6
all recent Mac systems run the 64 bit code.
 
7
 
 
8
Therefore, this script tells a small lie about the wheels we're producing. By
 
9
claiming they are fat ('intel') wheels, pip will install them on more Python
 
10
installations. This should not cause problems for the vast majority of users.
 
11
"""
 
12
import glob
 
13
import os
 
14
import sys
 
15
 
 
16
# There should be exactly one .whl
 
17
filenames = glob.glob('dist/*.whl')
 
18
 
 
19
if len(filenames) < 1:
 
20
    sys.exit("No wheels found")
 
21
elif len(filenames) > 1:
 
22
    print("Multiple wheels found:")
 
23
    for f in filenames:
 
24
        print("  {}".format(f))
 
25
    sys.exit(1)
 
26
 
 
27
path = filenames[0]
 
28
 
 
29
if '_intel' in path:
 
30
    print("Wheel already tagged 'intel':")
 
31
    print(path)
 
32
    sys.exit(0)
 
33
elif '_x86_64' not in path:
 
34
    print("Didn't find '_x86_64' in wheel filename:")
 
35
    print(path)
 
36
    sys.exit(1)
 
37
 
 
38
new_path = path.replace('_x86_64', '_intel')
 
39
os.rename(path, new_path)
 
40
print("Renamed wheel to:")
 
41
print(new_path)