Skip to content

Commit

Permalink
Merge pull request #7 from mktums/master
Browse files Browse the repository at this point in the history
Update to PyPy 1.9
  • Loading branch information
Alexei Boronine committed Feb 14, 2013
2 parents 960e7d9 + 40ae64c commit 624aa54
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
25 changes: 15 additions & 10 deletions pypyenv.py
Expand Up @@ -6,7 +6,7 @@
import stat
import platform

__version__ = "0.1.3"
__version__ = "0.1.4"

base = sys.prefix
srcdir = "src"
Expand All @@ -17,9 +17,11 @@
version = sys.version[:3]
yes = ("y", "yes")


def out(s):
print " * " + s


def install(download):
os.chdir(base)
# Clean up if anything was left over
Expand All @@ -42,7 +44,7 @@ def install(download):
break
archivefile.write(data)
archivefile.close()
# Unpack archive
# Unpack archive
archiveobj = tarfile.open(archive, mode="r:bz2")
unpacked = os.path.join(srcdir, archiveobj.next().name)
if os.path.exists(unpacked):
Expand All @@ -65,9 +67,10 @@ def install(download):
shutil.rmtree(pypysite)
os.symlink(pythonsite, pypysite)


def uninstall():
os.chdir(base)
if os.path.exists(binpypy):
if os.path.exists(binpypy):
if confirm_deletion(binpypy):
os.remove(binpypy)
else:
Expand All @@ -78,18 +81,21 @@ def uninstall():
else:
sys.exit(1)


def confirm_deletion(tree):
return raw_input("Delete ENV/%s? [y/N] " % tree) in yes


help_message = """ pypyenv install - installs PyPy in this virtualenv
pypyenv uninstall - uninstalls PyPy from this virtualenv"""


def main():
args = sys.argv[1:]
if version != "2.7":
if not raw_input("PyPy implements Python 2.7, you are using a " \
if not raw_input("PyPy implements Python 2.7, you are using a "
"different version, continue? [y/N] ") in yes:
sys.exit(1)
sys.exit(1)

if len(args) != 1:
print help_message
Expand All @@ -107,16 +113,15 @@ def main():
sys.exit(2)

if linux and x86:
download = "https://bitbucket.org/pypy/pypy/downloads/pypy-1.7-linux.tar.bz2"
download = "https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-linux.tar.bz2"
elif linux and x86_64:
download = "https://bitbucket.org/pypy/pypy/downloads/pypy-1.7-linux64.tar.bz2"
download = "https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-linux64.tar.bz2"
elif osx:
download = "https://bitbucket.org/pypy/pypy/downloads/pypy-1.7-osx64.tar.bz2"
download = "https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-osx64.tar.bz2"

if args[0] == "install":
install(download)
elif args[0] == "uninstall":
uninstall()
else:
print help_message

print help_message
6 changes: 3 additions & 3 deletions setup.py
Expand Up @@ -11,8 +11,8 @@
name='pypyenv',
version=__version__,
description='Install PyPy in virtualenv',
long_description="Install PyPy as an optional Python interpretor "\
"in a virtualenv on Linux and OS X systems.",
long_description="Install latest stable PyPy as an optional Python interpretor "
"in a virtualenv on Linux and OS X systems.",
author="Alexei Boronine",
license="MIT",
author_email="alexei.boronine@gmail.com",
Expand All @@ -28,7 +28,7 @@
"Topic :: Software Development"
],
py_modules=["pypyenv"],
entry_points = {
entry_points={
'console_scripts': [
'pypyenv = pypyenv:main'
]
Expand Down

0 comments on commit 624aa54

Please sign in to comment.