forked from ismet55555/yojenkins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
114 lines (98 loc) · 3.78 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
110
111
112
113
114
"""Installation/Packaging Definition for Python Project"""
import os
import sys
import setuptools
# Package version number (Updated via bump2version tool)
__version__ = "0.0.86"
def check_py_version():
"""Check the python version"""
if sys.version_info < (3, 7):
print('Your Python version ({}.{}) is not supported'.format(sys.version_info.major, sys.version_info.minor))
print('You must have Python version 3.7 or higher to run this program')
if sys.version_info.major < 3:
print('You may have used "python" where you needed to use "python3"?')
sys.exit(1)
def get_requirements():
"""Load packages from requirements.txt"""
check_py_version()
with open(os.path.join(os.path.dirname(__file__), "requirements.txt")) as handle:
packages = handle.readlines()
packages = [package.strip() for package in packages]
return packages
def get_pipfile_requirements():
"""Load packages from Pipfile"""
from toml import loads
# Loading Pipfile
try:
with open ('Pipfile', 'r') as open_file:
pipfile = open_file.read()
pipfile_toml = loads(pipfile)
except FileNotFoundError:
return []
# Getting the "packages section"
try:
required_packages = pipfile_toml['packages'].items()
except KeyError:
return []
# Parsing Pipfile
packages = []
for package_name, ver in required_packages:
version = ver
if not isinstance(ver, str): # Check for a dict
version_parts = []
if 'version' in ver:
version_parts.append(ver['version'] if ver['version'] != '*' else "")
if 'platform_system' in ver:
version_parts.append(f"platform_system {ver['platform_system']}")
version = '; '.join(version_parts)
packages.append(package_name if version == "*" else f"{package_name}{version}")
return packages
def read(fname):
"""Utility function to read the README file. Used for the long_description"""
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setuptools.setup(
name="yojenkins",
version=__version__,
author="Ismet Handzic",
author_email="ismet.handzic@gmail.com",
maintainer="Ismet Handzic",
description="A CLI tool to manage and have fun with Jenkins server",
keywords="jenkins monitor manage job build fun",
url="https://github.com/ismet55555/yojenkins",
packages=setuptools.find_packages(),
install_requires=get_requirements(),
extras_require={
'sound': ['simpleaudio; sys_platform != "win32"']
},
include_package_data=True,
long_description=read('README.md'),
long_description_content_type='text/markdown',
python_requires='>=3.7',
setup_requires=['wheel'],
py_modules=["yojenkins"],
entry_points={
"console_scripts": [
"yojenkins = yojenkins.__main__:main"
]
},
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Intended Audience :: System Administrators',
'Intended Audience :: Developers',
'Topic :: Utilities',
'Topic :: Software Development :: Testing',
'Topic :: System :: Monitoring',
'Topic :: Software Development :: Libraries :: Python Modules',
"Environment :: Console",
"Environment :: Console :: Curses",
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3 :: Only'
]
)