Skip to content

Commit 50aab09

Browse files
committed
Get started with python 3 migration
1 parent d765eaa commit 50aab09

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ mrclient.h
55
*.pyc
66
build
77
dist
8+
9+
# Cython autogenerated
10+
*.egg-info

README

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
Installing PyMoira
33
==================
44

5-
To install PyMoira, you will first need to install Pyrex_. It's always
5+
To install PyMoira, you will first need to install Cython. It's always
66
a good idea to install Pyrex through your package manager, if
7-
possible. Your system's Pyrex package may be named ``python-pyrex`` or
8-
``pyrex-py25``. If your package manager doesn't have a package for
7+
possible. Your system's Pyrex package may be named ``python3-Cython`` or
8+
``cython3``. If your package manager doesn't have a package for
99
Pyrex, or if you wish to install Pyrex by hand anyway, you can do so
1010
by running::
1111

12-
$ easy_install Pyrex
12+
$ pip install Cython
1313

1414
Once you've done that, to install PyMoira globally, run::
1515

16-
$ python setup.py install
16+
$ pip install .
1717

1818
If you want to build PyMoira without installing it globally, you may
1919
want to run::
@@ -27,6 +27,8 @@ working directory is the root of the PyMoira source tree.
2727
Alternatively, PyMoira has been packaged for Debian and Ubuntu. To
2828
build the Debian package of the latest release, run::
2929

30+
_(NOTE: deb generation is untested)_
31+
3032
$ git checkout debian
3133
$ git buildpackage
3234
$ sudo debi

moira.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def query(handle, *args, **kwargs):
126126
results = []
127127

128128
for r in plain_results:
129-
results.append(fmt(zip(_return_cache[handle], r)))
129+
results.append(fmt(list(zip(_return_cache[handle], r))))
130130

131131
return results
132132

@@ -149,7 +149,7 @@ def access(handle, *args, **kwargs):
149149
try:
150150
_moira._access(handle, *args)
151151
return True
152-
except MoiraException, e:
152+
except MoiraException as e:
153153
if e.code != errors()['MR_PERM']:
154154
raise
155155
return False

qy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def main():
5353
moira.auth(options.program)
5454

5555
if args[0].startswith('_'):
56-
print '\n'.join(', '.join(x) for x in
57-
moira._list_query(*args))
56+
print('\n'.join(', '.join(x) for x in
57+
moira._list_query(*args)))
5858
else:
5959
results = moira.query(fmt=tuple, *args)
6060

@@ -63,11 +63,11 @@ def main():
6363
r = filter_fields(r, options.fields)
6464

6565
if options.single:
66-
print ', '.join(v for (k, v) in r)
66+
print(', '.join(v for (k, v) in r))
6767
else:
6868
for k, v in r:
69-
print '%-*s: %s' % (keylen, k, v)
70-
print
69+
print('%-*s: %s' % (keylen, k, v))
70+
print()
7171

7272
if __name__ == '__main__':
7373
main()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from setuptools import setup
44
from distutils.extension import Extension
5-
from Pyrex.Distutils import build_ext
5+
from Cython.Distutils import build_ext
66

77
setup(
88
name="PyMoira",

0 commit comments

Comments
 (0)