forked from vroncevic/gen_stm8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
131 lines (125 loc) · 4.51 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
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
Module
setup.py
Copyright
Copyright (C) 2018 Vladimir Roncevic <[email protected]>
gen_stm8 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_stm8 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
Defined setup for tool gen_stm8.
'''
from __future__ import print_function
import sys
from os.path import abspath, dirname, join, exists
from setuptools import setup
__author__ = 'Vladimir Roncevic'
__copyright__ = 'Copyright 2018, https://vroncevic.github.io/gen_stm8'
__credits__ = ['Vladimir Roncevic']
__license__ = 'https://github.com/vroncevic/gen_stm8/blob/dev/LICENSE'
__version__ = '1.2.1'
__maintainer__ = 'Vladimir Roncevic'
__email__ = '[email protected]'
__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_stm8/'
if not INSTALL_DIR:
print('[setup] force exit from install process')
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_stm8',
version='1.2.1',
description='STM8 project skeleton generator',
author='Vladimir Roncevic',
author_email='[email protected]',
url='https://vroncevic.github.io/gen_stm8/',
license='GPL 2018 Free software to use and distributed it.',
long_description=LONG_DESCRIPTION,
long_description_content_type='text/markdown',
keywords='STM, STM8, project, C, Unix, Linux',
platforms='POSIX',
classifiers=PYP_CLASSIFIERS,
packages=['gen_stm8', 'gen_stm8.pro', 'gen_stm8.pro.config'],
install_requires=['ats-utilities'],
package_data = {
'gen_stm8': [
'conf/gen_stm8.cfg',
'conf/gen_stm8_util.cfg',
'conf/project.yaml',
'conf/template/Makefile.template',
'conf/template/module.template',
'conf/template/stm8s.template',
'log/gen_stm8.log'
]
},
data_files=[
('/usr/local/bin/', ['gen_stm8/run/gen_stm8_run.py']),
('/usr/local/bin/', ['gen_stm8/run/factory_reset.sh'])
]
)