-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
109 lines (91 loc) · 2.92 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import os
import datetime
from setuptools import setup, find_packages, Command
class GenerateSpecCommand(Command):
"""Custom command to generate an RPM .spec file."""
description = 'Generate an RPM spec file dynamically'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
spec_content = f"""%global name {self.distribution.get_name()}
%global version {self.distribution.get_version()}
%global release 1%{{?dist}}
%global summary {self.distribution.get_description()}
Name: %{{name}}
Version: %{{version}}
Release: %{{release}}
Summary: %{{summary}}
License: MIT
URL: https://github.com/madebyjake/md5sift
Source0: %{{name}}-%{{version}}.tar.gz
BuildArch: noarch
BuildRequires: python3-devel python3-setuptools
Requires: python3
%description
Quickly generate MD5 checksum reports for large directories with filtering options.
%prep
%setup -q
%build
%py3_build
%install
%py3_install
install -d %{{buildroot}}%{{python3_sitelib}}
%files
%license LICENSE
%doc README.md
%{{_bindir}}/md5sift
%{{python3_sitelib}}/md5sift
%{{python3_sitelib}}/md5sift/*
%{{python3_sitelib}}/md5sift/__main__.py
%{{python3_sitelib}}/md5sift-*.egg-info
%changelog
* {datetime.datetime.now().strftime('%a %b %d %Y')} Jake Wells <https://github.com/madebyjake/>
- https://github.com/madebyjake/md5sift/releases/
"""
with open('md5sift.spec', 'w') as spec_file:
spec_file.write(spec_content)
print("✅ RPM spec file 'md5sift.spec' has been successfully generated!")
try:
with open('README.md', 'r') as f:
long_description = f.read()
except FileNotFoundError:
long_description = "Quickly generate MD5 checksum reports for large directories with filtering options."
# Extract version from __main__.py
version = None
with open(os.path.join(os.path.dirname(__file__), 'md5sift', '__main__.py')) as f:
for line in f:
if line.startswith('VERSION'):
version = line.split('=')[1].strip().strip('"').strip("'")
break
setup(
name='md5sift',
version=version,
packages=find_packages(),
py_modules=['md5sift'],
entry_points={
'console_scripts': [
'md5sift=md5sift.__main__:main'
]
},
install_requires=[
"click>=7.0,<9.0",
],
author='Jake Wells',
author_email='[email protected]',
description='Quickly generate MD5 checksum reports for large directories with filtering options.',
license='MIT',
url='https://github.com/madebyjake/md5sift',
classifiers=[
'Programming Language :: Python :: 3',
'License :: OSI Approved :: MIT License'
],
python_requires='>=3.6',
long_description=long_description,
long_description_content_type='text/markdown',
cmdclass={
'genspec': GenerateSpecCommand,
}
)