-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
134 lines (126 loc) · 4.52 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
Module
setup.py
Copyright
Copyright (C) 2019 Vladimir Roncevic <elektron.ronca@gmail.com>
gen_shared_file is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
gen_shared_file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
Info
Define setup for tool gen_shared_file.
'''
from __future__ import print_function
import sys
from os.path import abspath, dirname, join, exists
from setuptools import setup
__author__ = 'Vladimir Roncevic'
__copyright__ = 'Copyright 2019, https://vroncevic.github.io/gen_shared_file'
__credits__ = ['Vladimir Roncevic']
__license__ = 'https://github.com/vroncevic/gen_shared_file/blob/dev/LICENSE'
__version__ = '1.0.0'
__maintainer__ = 'Vladimir Roncevic'
__email__ = 'elektron.ronca@gmail.com'
__status__ = 'Updated'
def install_directory():
'''
Return the installation directory, or None.
:return: path (success) | None.
:rtype: <str> | <NoneType>
:exceptions: None
'''
py_version = '{0}.{1}'.format(sys.version_info[0], sys.version_info[1])
if '--github' in sys.argv:
index = sys.argv.index('--github')
sys.argv.pop(index)
paths = (
'{0}/lib/python{1}/dist-packages/'.format(sys.prefix, py_version),
'{0}/lib/python{1}/site-packages/'.format(sys.prefix, py_version)
)
else:
paths = (s for s in (
'{0}/local/lib/python{1}/dist-packages/'.format(
sys.prefix, py_version
),
'{0}/local/lib/python{1}/site-packages/'.format(
sys.prefix, py_version
)
))
message = None
for path in paths:
message = '[setup] check path {0}'.format(path)
print(message)
if exists(path):
message = '[setup] use path {0}'.format(path)
print(message)
return path
message = '[setup] no installation path found, check {0}\n'.format(
sys.prefix
)
print(message)
return None
INSTALL_DIR = install_directory()
TOOL_DIR = 'gen_shared_file/'
if not bool(INSTALL_DIR):
print('[setup] force exit from install process')
sys.exit(127)
THIS_DIR, LONG_DESCRIPTION = abspath(dirname(__file__)), None
with open(join(THIS_DIR, 'README.md')) as readme:
LONG_DESCRIPTION = readme.read()
PROGRAMMING_LANG = 'Programming Language :: Python ::'
VERSIONS = ['2.7', '3', '3.2', '3.3', '3.4']
SUPPORTED_PY_VERSIONS = [
'{0} {1}'.format(PROGRAMMING_LANG, VERSION) for VERSION in VERSIONS
]
LICENSE_PREFIX = 'License :: OSI Approved ::'
LICENSES = [
'GNU Lesser General Public License v2 (LGPLv2)',
'GNU Lesser General Public License v2 or later (LGPLv2+)',
'GNU Lesser General Public License v3 (LGPLv3)',
'GNU Lesser General Public License v3 or later (LGPLv3+)',
'GNU Library or Lesser General Public License (LGPL)'
]
APPROVED_LICENSES = [
'{0} {1}'.format(LICENSE_PREFIX, LICENSE) for LICENSE in LICENSES
]
PYP_CLASSIFIERS = SUPPORTED_PY_VERSIONS + APPROVED_LICENSES
setup(
name='gen_shared_file',
version='1.0.0',
description='Generating Shared File Modules',
author='Vladimir Roncevic',
author_email='elektron.ronca@gmail.com',
url='https://vroncevic.github.io/gen_shared_file',
license='GPL 2019 Free software to use and distributed it.',
long_description=LONG_DESCRIPTION,
long_description_content_type='text/markdown',
keywords='Unix, Linux, Development, Shared File, Modules',
platforms='POSIX',
classifiers=PYP_CLASSIFIERS,
packages=[
'gen_shared_file', 'gen_shared_file.pro',
],
install_requires=['ats-utilities'],
package_data={
'gen_shared_file': [
'conf/gen_shared_file.logo',
'conf/gen_shared_file.cfg',
'conf/gen_shared_file_util.cfg',
'conf/template/generator_test.template',
'log/gen_shared_file.log'
]
},
data_files=[(
'/usr/local/bin/', [
'{0}{1}'.format(TOOL_DIR, 'run/gen_shared_file_run.py')
]
)]
)