-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
102 lines (89 loc) · 3.47 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
"""
pyavrdebug
GDB RSP server implementation for debugging AVR MCUs with UPDI using Microchip CMSIS-DAP based debuggers
"""
import time
from os import path
from os import chdir
from os import popen
# To use a consistent encoding
from codecs import open
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
here = path.abspath(path.dirname(__file__))
chdir(here)
# Get the long description from the pypi file
# Using UTF8 and single newlines
with open(path.join(here, 'pypi.md'), 'rb') as f:
long_description = f.read().decode("utf-8").replace('\r\n', '\n')
# Set the package name:
name = 'pyavrdebug'
"""
Package version :
The version number follow the format major.minor.patch.build
major, minor and patch are set manually according to semantic versioning 2.0.0: https://semver.org
build is an incrementing number set by a build server
in case of installing from source, build is set to 'dev' as allowed by PEP440
"""
# Package version setup
PACKAGE_VERSION = {
"major": 0, # Set the major version
"minor": 0, # Set the minor number
"patch": 0, # Set the patch number
"build": 'dev0', # Source distributions use "dev" as build number
}
version = "{}.{}.{}.{}".format(PACKAGE_VERSION['major'], PACKAGE_VERSION['minor'], PACKAGE_VERSION['patch'], PACKAGE_VERSION['build'])
print("Building {} version: {}".format(name, version))
# Create a "version.py" file in the package
fname = "{}/version.py".format(name)
with open(path.join(here, fname), 'w') as f:
f.write("\"\"\" This file was generated when {} was built \"\"\"\n".format(name))
f.write("VERSION = '{}'\n".format(version))
# The command below can fail if git command not available, or not in a git workspace folder
result = popen("git rev-parse HEAD").read()
commit_id = result.splitlines()[0] if result else "N/A"
f.write("COMMIT_ID = '{}'\n".format(commit_id))
f.write("BUILD_DATE = '{}'\n".format(time.strftime("%Y-%m-%d %H:%M:%S %z")))
# Read in requirements (dependencies) file
with open('requirements.txt') as f:
install_requires = f.read()
setup(
name=name,
version=version,
description='GDB RSP server implementation for debugging AVR MCUs with UPDI using Microchip CMSIS-DAP based debuggers',
long_description=long_description,
long_description_content_type='text/markdown',
url='',
license='MIT',
author='mraardvark',
author_email='',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Embedded Systems',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS',
],
packages=find_packages(exclude=['tests']),
# List of packages required to use this package
install_requires=install_requires,
# List of packages required to develop and test this package
extras_require={
'dev': ['pylint', 'mock', 'parameterized', 'pytest'],
},
# Include files from MANIFEST.in
include_package_data=True,
# Installable CLI entry point
entry_points={
'console_scripts': [
'pyavrdebug=pyavrdebug.pyavrdebug:main',
],
},
)