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

Python3 support #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions bin/make_package_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

try:
import yaml
except ImportError, err:
except ImportError as err:
die(ENOYAML)

def get_config():
Expand Down Expand Up @@ -67,13 +67,13 @@ def check_config(config):
module = config['version_from_module']
del config['version_from_module']
ns = {}
exec('import ' + module) in ns
exec(('import ' + module), ns)
config['version'] = ns[module].__version__

if 'description' not in config:
module = config['name']
ns = {}
exec('import ' + module) in ns
exec(('import ' + module), ns)
desc = ns[module].__doc__
m = re.match(r'\s*([^\.\!\n]*)', desc)
if m:
Expand Down Expand Up @@ -111,15 +111,15 @@ def get():

file = 'package/info.py'
action = os.path.exists(file) and 'Updated' or 'Created'
print "%(action)s the '%(file)s' module for this package." % locals()
print("%(action)s the '%(file)s' module for this package." % locals())

f = open(file, 'w')
f.write(module)
f.close()

def update_template(config, file):
if not os.path.exists(file):
print "Warning: %s does not exist." % file
print("Warning: %s does not exist." % file)
return
f = open(file, 'r')
text = f.read()
Expand All @@ -128,12 +128,12 @@ def update_template(config, file):
return
try:
text = text % config
except KeyError, err:
except KeyError as err:
die(EBADINFO, err=err)
f = open(file, 'w')
f.write(text)
f.close()
print "Updated '%s' with your info" % file
print("Updated '%s' with your info" % file)

def add_failing_tests(config):
file = "%s/__init__.py" % config['name']
Expand Down
6 changes: 3 additions & 3 deletions layout/package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
try:
from setuptools import setup as real_setup
has_setuptools = True
except ImportError, err:
except ImportError as err:
try:
from distutils.core import setup as real_setup
except ImportError, err:
except ImportError as err:
die(ENOSETUP)

class setup():
Expand All @@ -29,7 +29,7 @@ def __init__(self):
def get_args(self):
try:
import package.info
except ImportError, err:
except ImportError as err:
die(ENOINFO)

args = package.info.get()
Expand Down
4 changes: 2 additions & 2 deletions layout/package/unittest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import absolute_import


import os

Expand All @@ -17,7 +17,7 @@ def assertTextEquals(self, got, expected, msg=None):
file('got', 'w').write(got)
os.system('diff -u expected got')

self.assertEquals(got, expected, msg)
self.assertEqual(got, expected, msg)

class main():
def __init__(self, module='__main__', argv=None):
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# coding=utf-8

print """
print("""
Greetings!

It looks like you are trying to install this package (called `package`). STOP!
Expand All @@ -28,5 +28,5 @@

Enjoy!

"""
""")