This repository has been archived by the owner on Aug 9, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
95 lines (83 loc) · 2.7 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
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Install plexhints
"""
import os
from pkg_resources import parse_requirements
try:
from setuptools import setup, find_namespace_packages
except ImportError:
from setuptools import setup, find_packages
find_namespace_packages = find_packages
def list_files(directory):
# type: (str) -> list
"""
List all files in a directory.
Parameters
----------
directory : str
The directory to list files from.
Returns
-------
list
A list of all files in the directory.
"""
paths = []
for (path, directories, filenames) in os.walk(directory):
for filename in filenames:
paths.append(os.path.join(path, filename))
return paths
# Get version
version = dict()
with open('plexhints/const.py') as handle:
exec(handle.read(), version)
version['__version__'] = os.environ.get('BUILD_VERSION', '0.0.0')
# remove leading v from the version tag if present
version['__version__'] = version['__version__'].lstrip('v')
# Include files required to install from the PyPI source distribution
data_files = [('', ['README.rst', 'requirements.txt'])]
docs_files = list_files('docs')
data_files.append(('docs', docs_files))
# Concatenate README files
readme_files = [
'README.rst',
os.path.join('docs', 'source', 'about', 'installation.rst'),
os.path.join('docs', 'source', 'about', 'usage.rst'),
]
readme = ''
for readme_file in readme_files:
# Get file contents
with open(readme_file) as handle:
readme += handle.read()
readme += '\n'
# Get requirements
with open('requirements.txt') as handle:
requirements = [str(req) for req in parse_requirements(handle)]
setup(
name=version['__name__'],
version=version['__version__'],
description=version['__description__'],
author='LizardByte',
author_email='[email protected]',
url='https://github.com/LizardByte/plexhints',
packages=['plexhints'],
install_requires=requirements,
python_requires='>=2.7',
long_description=readme,
long_description_content_type='text/x-rst',
keywords=['plex', 'agent', 'plug-in', 'debug'],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Topic :: Software Development :: Libraries :: Python Modules',
],
data_files=data_files,
)