Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 support. #74

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@

import sys, os, shutil, glob

sys.argv.append('build')

# Some Angstrom images are missing the py_compile module; get it if not
# present:
import random
python_lib_path = random.__file__.split('random')[0]
if not os.path.exists(python_lib_path + 'py_compile.py'):
print "py_compile module missing; installing to %spy_compile.py" %\
python_lib_path
import urllib2
url = "http://hg.python.org/cpython/raw-file/4ebe1ede981e/Lib/py_compile.py"
py_compile = urllib2.urlopen(url)
with open(python_lib_path+'py_compile.py', 'w') as f:
f.write(py_compile.read())
print "testing py_compile..."
print("py_compile module missing; installing to %spy_compile.py" %\
python_lib_path)
try:
import py_compile
print "py_compile installed successfully"
except Exception, e:
print "*py_compile install failed, could not import"
print "*Exception raised:"
raise e
except ImportError:
try:
import urllib.request as urllib2
except ImportError:
import urllib2
url = "http://hg.python.org/cpython/raw-file/4ebe1ede981e/Lib/py_compile.py"
py_compile = urllib2.urlopen(url)
with open(python_lib_path+'py_compile.py', 'wb') as f:
f.write(py_compile.read())
print("testing py_compile...")
try:
import py_compile
print("py_compile installed successfully")
except Exception as e:
print("*py_compile install failed, could not import")
print("*Exception raised:")
raise e

print "Installing PyBBIO..."
print("Installing PyBBIO...")

from setuptools import setup, Extension, find_packages

Expand Down