Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
Installing PyMoira
==================

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

$ easy_install Pyrex
$ easy_install Cython

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

Expand All @@ -33,7 +33,7 @@ build the Debian package of the latest release, run::

You will need the devscripts and git-buildpackage packages installed,
as well as this package's build dependencies (debhelper, cdbs,
python-all-dev, python-support, python-pyrex, python-setuptools,
python-all-dev, python-support, python-cython, python-setuptools,
debathena-libmoira-dev).

.. _Pyrex: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
.. _Cython: https://cython.org/
4 changes: 4 additions & 0 deletions _moira.pyx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# cython: c_string_type=unicode, c_string_encoding=ascii

cdef extern from "moira/moira.h":
int mr_krb5_auth(char * prog)
int mr_auth(char * prog)
Expand Down Expand Up @@ -57,6 +59,8 @@ def connect(server=''):
if __connected:
disconnect()

if isinstance(server, unicode):
server = server.encode('idna')
status = mr_connect(server)
if status != MR_SUCCESS:
_error(status)
Expand Down
2 changes: 1 addition & 1 deletion moira.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def access(handle, *args, **kwargs):
try:
_moira._access(handle, *args)
return True
except MoiraException, e:
except MoiraException as e:
if e.code != errors()['MR_PERM']:
raise
return False
Expand Down
10 changes: 6 additions & 4 deletions qy
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/python
"""qy: A scriptable, command-line Moira client."""

from __future__ import print_function

import optparse

import moira
Expand Down Expand Up @@ -53,8 +55,8 @@ def main():
moira.auth(options.program)

if args[0].startswith('_'):
print '\n'.join(', '.join(x) for x in
moira._list_query(*args))
print('\n'.join(', '.join(x) for x in
moira._list_query(*args)))
else:
results = moira.query(fmt=tuple, *args)

Expand All @@ -63,10 +65,10 @@ def main():
r = filter_fields(r, options.fields)

if options.single:
print ', '.join(v for (k, v) in r)
print(', '.join(v for (k, v) in r))
else:
for k, v in r:
print '%-*s: %s' % (keylen, k, v)
print('%-*s: %s' % (keylen, k, v))
print

if __name__ == '__main__':
Expand Down
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@

from setuptools import setup
from distutils.extension import Extension
from Pyrex.Distutils import build_ext
from Cython.Build import cythonize

setup(
name="PyMoira",
version="4.3.0",
version="4.3.1",
description="PyMoira - Python bindings for the Athena Moira library",
author="Evan Broder",
author_email="broder@mit.edu",
license="MIT",
py_modules=['moira'],
ext_modules=[
ext_modules=cythonize([
Extension("_moira",
["_moira.pyx"],
libraries=["moira", "krb5"]),
Extension("mrclient",
["mrclient.pyx"],
libraries=["mrclient", "moira"]),
],
]),
scripts=['qy'],
cmdclass= {"build_ext": build_ext}
)