2011-04-29 18:02:18 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
'''
|
|
|
|
Setup script for eopayment
|
|
|
|
'''
|
|
|
|
|
2018-07-26 17:04:01 +02:00
|
|
|
import io
|
2015-07-16 11:46:19 +02:00
|
|
|
import subprocess
|
2011-04-29 18:02:18 +02:00
|
|
|
import distutils
|
2011-05-02 09:56:29 +02:00
|
|
|
import distutils.core
|
2015-07-16 11:46:19 +02:00
|
|
|
import setuptools
|
|
|
|
from distutils.command.sdist import sdist
|
2012-01-31 10:59:26 +01:00
|
|
|
from glob import glob
|
2015-07-17 10:56:58 +02:00
|
|
|
from os.path import splitext, basename, join as pjoin, dirname
|
2012-01-31 10:59:26 +01:00
|
|
|
import os
|
|
|
|
from unittest import TextTestRunner, TestLoader
|
2015-03-04 14:49:16 +01:00
|
|
|
import doctest
|
2012-01-31 10:59:26 +01:00
|
|
|
|
2015-07-16 11:46:19 +02:00
|
|
|
|
2012-01-31 10:59:26 +01:00
|
|
|
class TestCommand(distutils.core.Command):
|
2015-07-16 11:46:19 +02:00
|
|
|
user_options = []
|
2012-01-31 10:59:26 +01:00
|
|
|
|
|
|
|
def initialize_options(self):
|
|
|
|
self._dir = os.getcwd()
|
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
'''
|
|
|
|
Finds all the tests modules in tests/, and runs them.
|
|
|
|
'''
|
2015-07-16 11:46:19 +02:00
|
|
|
testfiles = []
|
2012-01-31 10:59:26 +01:00
|
|
|
for t in glob(pjoin(self._dir, 'tests', '*.py')):
|
|
|
|
if not t.endswith('__init__.py'):
|
|
|
|
testfiles.append('.'.join(
|
|
|
|
['tests', splitext(basename(t))[0]])
|
|
|
|
)
|
|
|
|
|
|
|
|
tests = TestLoader().loadTestsFromNames(testfiles)
|
2015-03-04 14:49:16 +01:00
|
|
|
import eopayment
|
|
|
|
tests.addTests(doctest.DocTestSuite(eopayment))
|
2015-07-16 11:46:19 +02:00
|
|
|
t = TextTestRunner(verbosity=4)
|
2012-01-31 10:59:26 +01:00
|
|
|
t.run(tests)
|
2012-01-31 10:59:10 +01:00
|
|
|
|
2013-05-15 15:18:35 +02:00
|
|
|
|
2015-07-16 11:46:19 +02:00
|
|
|
class eo_sdist(sdist):
|
|
|
|
|
|
|
|
def run(self):
|
2018-03-26 09:56:16 +02:00
|
|
|
print("creating VERSION file")
|
2015-07-16 11:46:19 +02:00
|
|
|
if os.path.exists('VERSION'):
|
|
|
|
os.remove('VERSION')
|
|
|
|
version = get_version()
|
|
|
|
version_file = open('VERSION', 'w')
|
|
|
|
version_file.write(version)
|
|
|
|
version_file.close()
|
|
|
|
sdist.run(self)
|
2018-03-26 09:56:16 +02:00
|
|
|
print("removing VERSION file")
|
2015-07-16 11:46:19 +02:00
|
|
|
if os.path.exists('VERSION'):
|
|
|
|
os.remove('VERSION')
|
|
|
|
|
|
|
|
|
|
|
|
def get_version():
|
|
|
|
'''Use the VERSION, if absent generates a version with git describe, if not
|
|
|
|
tag exists, take 0.0.0- and add the length of the commit log.
|
|
|
|
'''
|
|
|
|
if os.path.exists('VERSION'):
|
|
|
|
with open('VERSION', 'r') as v:
|
|
|
|
return v.read()
|
2013-05-15 15:18:35 +02:00
|
|
|
if os.path.exists('.git'):
|
2015-07-16 11:46:19 +02:00
|
|
|
p = subprocess.Popen(['git', 'describe', '--dirty',
|
|
|
|
'--match=v*'], stdout=subprocess.PIPE,
|
|
|
|
stderr=subprocess.PIPE)
|
2013-05-15 15:18:35 +02:00
|
|
|
result = p.communicate()[0]
|
2015-07-16 11:46:19 +02:00
|
|
|
if p.returncode == 0:
|
2018-03-26 09:56:16 +02:00
|
|
|
version = str(result.split()[0][1:])
|
2015-09-22 10:46:37 +02:00
|
|
|
version = version.replace('-', '.')
|
|
|
|
return version
|
2015-07-16 11:46:19 +02:00
|
|
|
return '0.0.0'
|
2011-04-29 18:02:18 +02:00
|
|
|
|
2015-07-16 11:46:19 +02:00
|
|
|
setuptools.setup(
|
|
|
|
name='eopayment',
|
|
|
|
version=get_version(),
|
|
|
|
license='GPLv3 or later',
|
|
|
|
description='Common API to use all French online payment credit card '
|
|
|
|
'processing services',
|
2018-07-26 17:04:01 +02:00
|
|
|
long_description=io.open(
|
2015-07-17 10:56:58 +02:00
|
|
|
os.path.join(
|
|
|
|
os.path.dirname(__file__),
|
2018-07-26 17:04:01 +02:00
|
|
|
'README.txt'), encoding='utf-8').read(),
|
2015-07-16 11:46:19 +02:00
|
|
|
url='http://dev.entrouvert.org/projects/eopayment/',
|
|
|
|
author="Entr'ouvert",
|
|
|
|
author_email="info@entrouvert.com",
|
|
|
|
maintainer="Benjamin Dauvergne",
|
|
|
|
maintainer_email="bdauvergne@entrouvert.com",
|
2018-08-12 19:51:31 +02:00
|
|
|
classifiers=[
|
|
|
|
'Development Status :: 5 - Production/Stable',
|
|
|
|
'Environment :: Web Environment',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
|
|
|
|
'Operating System :: POSIX',
|
|
|
|
'Programming Language :: Python',
|
|
|
|
'Programming Language :: Python :: 2',
|
|
|
|
'Programming Language :: Python :: 3',
|
|
|
|
],
|
2015-07-16 11:46:19 +02:00
|
|
|
packages=['eopayment'],
|
|
|
|
install_requires=[
|
2016-07-27 13:10:57 +02:00
|
|
|
'pycrypto >= 2.5',
|
2018-10-12 15:33:47 +02:00
|
|
|
'pytz',
|
2016-07-27 13:10:57 +02:00
|
|
|
'requests',
|
2018-03-26 09:56:16 +02:00
|
|
|
'six',
|
2015-07-16 11:46:19 +02:00
|
|
|
],
|
2016-11-23 14:35:34 +01:00
|
|
|
cmdclass={
|
|
|
|
'sdist': eo_sdist,
|
|
|
|
}
|
2016-02-01 17:59:01 +01:00
|
|
|
)
|