-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathsetup.py
64 lines (44 loc) · 1.42 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
# -*- coding: utf-8 -*-
###########
# IMPORTS #
###########
# Standard
import os as _os
import os.path as _osp
import re as _re
import sys as _sys
# Libraries
import setuptools as _st
################
# PYTHON CHECK #
################
if _sys.version_info < (3, 8):
_sys.exit('Python 3.8 or greater is required.')
#################
# DYNAMIC SETUP #
#################
# Version
with open('pydtmc/__init__.py', 'r') as _file:
_file_content = _file.read()
_matches = _re.search(r'^__version__ = \'(\d+\.\d+\.\d+)\'$', _file_content, flags=_re.MULTILINE)
_current_version = _matches.group(1)
# Description
_base_directory = _osp.abspath(_osp.dirname(__file__))
with open(_osp.join(_base_directory, 'README.md'), encoding='utf-8') as _file:
_long_description_text = _file.read()
_long_description_text = _long_description_text[_long_description_text.index('\n') + 1:].strip()
# Package Files
_package_data_files = []
for (_location, _, _files) in _os.walk('data'):
for _file in _files:
if _file not in ['.gitattributes', '.gitignore', '.gitkeep']:
_package_data_files.append(_osp.join('..', _location, _file))
# Setup
_st.setup(
version=_current_version,
long_description=_long_description_text,
long_description_content_type='text/markdown',
packages=_st.find_packages(include=['pydtmc']),
include_package_data=True,
package_data={'data': _package_data_files}
)