-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
79 lines (68 loc) · 2.47 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
"""
Setup file for the ecommerce-payfort Open edX ecommerce payment processor backend plugin.
"""
import os
import re
from pathlib import Path
from setuptools import find_packages, setup
README = open(Path(__file__).parent / 'README.rst').read()
CHANGELOG = open(Path(__file__).parent / 'CHANGELOG.rst').read()
def get_version(*file_paths):
"""
Extract the version string from the file.
@param file_paths: The path to the file containing the version string.
@type file_paths: multiple str
"""
filename = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = open(filename, encoding="utf8").read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError('Unable to find version string.')
def package_data(pkg, root_list):
"""Generic function to find package_data for `pkg` under `root`."""
data = []
for root in root_list:
for dirname, _, files in os.walk(os.path.join(pkg, root)):
for fname in files:
data.append(os.path.relpath(os.path.join(dirname, fname), pkg))
return {pkg: data}
VERSION = get_version('ecommerce_payfort', '__init__.py')
setup(
name='ecommerce-payfort',
description='PayFort ecommerce payment processor backend plugin',
version=VERSION,
author='ZeitLabs',
author_email='[email protected]',
long_description=f'{README}\n\n{CHANGELOG}',
long_description_content_type='text/x-rst',
url='https://github.com/Zeit-Labs/ecommerce-payfort',
include_package_data=True,
zip_safe=False,
keywords='Django openedx openedx-plugin ecommerce payfort',
classifiers=[
'Development Status :: 3 - Alpha',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
],
install_requires=[
'Django~=3.2',
],
package_data=package_data('ecommerce_payfort', ['locale']),
packages=find_packages(
include=[
'ecommerce_payfort', 'ecommerce_payfort.*',
],
exclude=["*tests"],
),
entry_points={
'ecommerce': [
'ecommerce_payfort = ecommerce_payfort.apps:PayFortConfig',
],
},
)