Skip to content

Commit f5617d8

Browse files
committed
get ready to publish initial release v0.5.0
1 parent 0ecddc8 commit f5617d8

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CHANGELOG
2+
3+
## [v0.5.0](https://github.com/onlime/policyd-rate-guard/tree/v0.5.0) (2023-08-29)
4+
5+
- Initial release

run.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
# This program is distributed in the hope that it will be useful, but WITHOUT
4+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
5+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
6+
# more details.
7+
#
8+
# You should have received a copy of the GNU General Public License version 3
9+
# along with this program; if not, write to the Free Software Foundation, Inc., 51
10+
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
11+
#
12+
# (c) 2023 Onlime GmbH
13+
#
114
import os
215
import sentry_sdk
316
import socket

setup.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env python3
2+
import os
3+
from setuptools import setup
4+
5+
#
6+
# WIP: Not yet fully working / ready to be published on PyPI
7+
#
8+
9+
DESC = """A slick sender rate limit policy daemon for Postfix implemented in Python3."""
10+
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
11+
README = readme.read()
12+
data_files = []
13+
14+
15+
def add_data_file(dir, file, check_dir=False, mkdir=False):
16+
path = os.path.join(dir, os.path.basename(file))
17+
if not os.path.isfile(path):
18+
if not check_dir or mkdir or os.path.isdir(dir):
19+
if mkdir:
20+
try:
21+
os.mkdir(dir)
22+
except OSError:
23+
pass
24+
data_files.append((dir, [file]))
25+
26+
# if install as root populate /etc
27+
if os.getuid() == 0:
28+
add_data_file('/etc/logrotate.d', 'deployment/logrotate.d/policyd-rate-guard')
29+
add_data_file('/etc/systemd/system', 'deployment/systemd/policyd-rate-guard.service', check_dir=True)
30+
add_data_file('/etc/systemd/system', 'deployment/systemd/policyd-rate-guard-cleanup.service', check_dir=True)
31+
add_data_file('/etc/systemd/system', 'deployment/systemd/policyd-rate-guard-cleanup.timer', check_dir=True)
32+
# else use user .config dir
33+
#else:
34+
# conf_dir = os.path.expanduser("~/.config/")
35+
# add_data_file(conf_dir, 'policyd_rate_guard/policyd-rate-guard.yaml', mkdir=True)
36+
37+
38+
setup(
39+
name='policyd-rate-guard',
40+
version='0.5.0',
41+
description=DESC,
42+
long_description=README,
43+
author='Onlime GmbH',
44+
author_email='info@onlime.ch',
45+
license='GPLv3',
46+
url='https://github.com/nitmir/policyd-rate-limit',
47+
download_url="https://github.com/onlime/policyd-rate-guard/releases/latest",
48+
packages=['policyd_rate_guard', 'policyd_rate_guard.tests'],
49+
keywords=['Postfix', 'rate', 'limit', 'guard', 'email'],
50+
scripts=['run.py'],
51+
data_files=data_files,
52+
classifiers=[
53+
'Environment :: No Input/Output (Daemon)',
54+
'Intended Audience :: Developers',
55+
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
56+
'Operating System :: POSIX',
57+
'Programming Language :: Python',
58+
'Programming Language :: Python :: 3',
59+
'Topic :: Communications :: Email :: Mail Transport Agents',
60+
'Topic :: Communications :: Email :: Filters',
61+
],
62+
install_requires=["PyYAML >= 3.11"],
63+
zip_safe=False,
64+
)

0 commit comments

Comments
 (0)