diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2014-12-15 17:37:40 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2014-12-15 17:55:52 +0100 |
commit | f65b8f618ed0b59f0c2c14321bbfa9de8e802169 (patch) | |
tree | 372844320f2abac1579636198d36ec3a6e7d34eb /setup.py | |
parent | e3ab39bf39d0ba75f6eb504752ef0ffb4bf4a3b1 (diff) | |
download | pygn-f65b8f618ed0b59f0c2c14321bbfa9de8e802169.tar.gz |
Add a simple test suite.
And also fix one embarrassing typo in mail2news module.
Fixes #1
Fixes #4
Fixes #6
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 94 |
1 files changed, 79 insertions, 15 deletions
@@ -1,18 +1,45 @@ #!/usr/bin/python - -from setuptools import setup -from distutils.core import Extension +import unittest +import sys +from distutils.core import setup, Extension, Command from distutils.command.build_ext import build_ext from subprocess import check_call + +class RunTests(Command): + """New setup.py command to run all tests for the package. + """ + description = "run all tests for the package" + + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + tests = unittest.TestLoader().discover('.') + runner = unittest.TextTestRunner() + results = runner.run(tests) + sys.exit(not results.wasSuccessful()) + + class Build_WLP_ext(build_ext): def run(self): - self.make_file('wlp/command.y', 'wlp/y.tab.c', check_call, - ([['yacc', '-d', '-o', 'wlp/commands.tab.c', 'wlp/commands.y']]), - 'Generating lexer') - self.make_file('wlp/commands.l', 'wlp/lex.yy.c', check_call, - ([['lex', '-o', 'wlp/lex.yy.c', 'wlp/commands.l']]), - 'Generating parser') + self.make_file( + 'wlp/commands.y', 'wlp/commands.tab.c', check_call, + # Yes, the following line contains list-in-list-in-tuple, and + # that's how it should be. + # otherwise, subsequent calls down the stack unwind the list and + # check_call won't get it. + ([['yacc', '-d', '-o', 'wlp/commands.tab.c', 'wlp/commands.y']]), + 'Generating lexer') + self.make_file( + 'wlp/commands.l', 'wlp/lex.yy.c', check_call, + ([['lex', '-o', 'wlp/lex.yy.c', 'wlp/commands.l']]), + 'Generating parser') build_ext.run(self) # see https://github.com/Turbo87/py-xcsoar/blob/master/setup.py @@ -22,11 +49,48 @@ wlp_module = Extension('wlp', 'wlp/commands.tab.c', 'wlp/lex.yy.c']) -install_requirements = [''] +setup(name='pyg', + version='0.9.9', # the current Debian version is 0.9.8 + author="Cosimo Alfarano", + author_email="kalfa@debian.org", # FIXME I am an contributor? + description='Python Mail <-> News Gateway', + long_description=''' + Python Gateway Script from news to mail and vice versa. + + It is intended to be a full SMTP/NNTP rfc compliant gateway + with whitelist manager. + + You will probably have to install a mail-transport-agent and/or + news-transport-system package to manage SMTP/NNTP traffic. + + MTA is needed for mail2news service, since mail have to be + processed on a box where pyg is installed. You can use a remote + smtpserver for news2mail. + + News system is useful but not needed, since you can send articles to a + remote SMTP server (ie: moderated NG) where is installed pyg, otherwise you + will need it. -setup(name='PackageName', - version='1.0', - description='This is a demo package', - cmdclass={'build_ext': Build_WLP_ext}, + It refers to rfc 822 (mail) and 850 (news). + ''', + py_modules=['mail2news', 'news2mail', 'pyginfo', 'setup', 'whitelist'], ext_modules=[wlp_module], - install_requires=install_requirements) + scripts=['pygm2n', 'pygn2m'], + cmdclass={'build_ext': Build_WLP_ext, + 'test': RunTests}, + # TODO package actually requires lex and yacc port, but not sure + # how to say it here + requires=[], + license="GPLv2", + keywords=["nntp", "email", "gateway"], + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Programming Language :: Python :: 2.7', + 'Natural Language :: English', + 'Topic :: Office/Business :: Financial :: Accounting', + 'Topic :: Utilities', + 'Environment :: Console', + 'Operating System :: OS Independent', + 'License :: OSI Approved :: GNU Affero General Public License v3' + ] + ) |