Last active
August 29, 2015 14:00
-
-
Save ionelmc/80adf7f7066b49d72425 to your computer and use it in GitHub Desktop.
Creates an "alias package".
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/python | |
import os | |
import shutil | |
import subprocess | |
import sys | |
import tempfile | |
name = subprocess.check_output(['python', 'setup.py', '--name']).strip() | |
url = "https://pypi.python.org/pypi/%s/" % name | |
description = subprocess.check_output(['python', 'setup.py', '--description']).strip() | |
assert 'python' not in name | |
alias = "python-%s" % name | |
author = subprocess.check_output(['python', 'setup.py', '--author']).strip() | |
author_email = subprocess.check_output(['python', 'setup.py', '--author-email']).strip() | |
try: | |
path = tempfile.mkdtemp() | |
os.chdir(path) | |
with open(os.path.join(path, 'setup.py'), 'wb') as fh: | |
fh.write(b"""# encoding: utf8 | |
from setuptools import setup | |
setup( | |
name=%(alias)r, | |
version="0.0", | |
url=%(url)r, | |
description=%(description)r, | |
long_description='''Use `%(name)s <%(url)s>`_ instead.''', | |
author=%(author)r, | |
platforms=['all'], | |
zip_safe=False, | |
author_email=%(author_email)r, | |
install_requires=[%(name)r], | |
) | |
""" % globals()) | |
subprocess.call(['python', 'setup.py'] + sys.argv[1:]) | |
finally: | |
shutil.rmtree(path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment