-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
64 lines (57 loc) · 2.32 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
#!/usr/bin/env python3
import os
from setuptools import setup
#
# WIP: Not yet fully working / ready to be published on PyPI
#
DESC = """A slick sender rate limit policy daemon for Postfix implemented in Python3."""
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
data_files = []
def add_data_file(dir, file, check_dir=False, mkdir=False):
path = os.path.join(dir, os.path.basename(file))
if not os.path.isfile(path):
if not check_dir or mkdir or os.path.isdir(dir):
if mkdir:
try:
os.mkdir(dir)
except OSError:
pass
data_files.append((dir, [file]))
# if install as root populate /etc
if os.getuid() == 0:
add_data_file('/etc/logrotate.d', 'deployment/logrotate.d/policyd-rate-guard')
add_data_file('/etc/systemd/system', 'deployment/systemd/policyd-rate-guard.service', check_dir=True)
add_data_file('/etc/systemd/system', 'deployment/systemd/policyd-rate-guard-cleanup.service', check_dir=True)
add_data_file('/etc/systemd/system', 'deployment/systemd/policyd-rate-guard-cleanup.timer', check_dir=True)
# else use user .config dir
# else:
# conf_dir = os.path.expanduser("~/.config/")
# add_data_file(conf_dir, 'policyd_rate_guard/policyd-rate-guard.yaml', mkdir=True)
setup(
name='policyd-rate-guard',
version='0.5.0',
description=DESC,
long_description=README,
author='Onlime GmbH',
author_email='info@onlime.ch',
license='GPLv3',
url='https://github.com/nitmir/policyd-rate-limit',
download_url="https://github.com/onlime/policyd-rate-guard/releases/latest",
packages=['policyd_rate_guard', 'policyd_rate_guard.tests'],
keywords=['Postfix', 'rate', 'limit', 'guard', 'email'],
scripts=['run.py'],
data_files=data_files,
classifiers=[
'Environment :: No Input/Output (Daemon)',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Communications :: Email :: Mail Transport Agents',
'Topic :: Communications :: Email :: Filters',
],
install_requires=["PyYAML >= 3.11"],
zip_safe=False,
)