Created
May 20, 2014 04:19
-
-
Save matthew-brett/51bdd3c817bd6541b950 to your computer and use it in GitHub Desktop.
Script to rename wheel files built with MacPython, to express compatibility with 10.9 system python and homebrew.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" Rename MacPython wheels for system python and homebrew """ | |
from __future__ import print_function | |
import os | |
from os.path import expanduser, splitext | |
import sys | |
from wheel.install import WheelFile | |
POP_PLAT_TAG = 'macosx_10_6_intel' | |
SYS_PLAT_TAG = 'macosx_10_9_intel' | |
BREW_PLAT_TAG = 'macosx_10_9_x86_64' | |
def main(): | |
paths = sys.argv[1:] | |
for path in paths: | |
path = expanduser(path) | |
whl_obj = WheelFile(path) | |
tags = list(whl_obj.tags) | |
plat_tags = [plat for pyver, abi, plat in tags] | |
if plat_tags == [POP_PLAT_TAG]: | |
fore, aft = splitext(path) | |
new_path = '{0}.{1}.{2}{3}'.format( | |
fore, SYS_PLAT_TAG, BREW_PLAT_TAG, aft) | |
os.rename(path, new_path) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment