forked from protonyx/labtronyx-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
138 lines (108 loc) · 3.66 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
135
136
137
138
"""
Setuptools build file
:author: KKENNEDY
"""
# Version (Semantic Versioning)
VER_MAJOR = 1
VER_MINOR = 0
VER_PATCH = 0
# Is this a release version? If so, additional data is appended to full version
RELEASE = False
# Pre-Release type
REL_TYPE = 'dev0' # Development Release
# REL_TYPE = 'alpha0' # Alpha Release
# REL_TYPE = 'beta0' # Beta Release
# REL_TYPE = 'rc1' # Release Candidate
# -----------------------------------------------------------------------
# DO NOT CHANGE ANYTHING BELOW THIS LINE
# -----------------------------------------------------------------------
import sys, os, time
def generate_ver(filename='labtronyx-gui/version.py'):
# Get Git Revision
try:
import subprocess
GIT_REVISION = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
except:
GIT_REVISION = ''
# Generate version string
VERSION = '%d.%d.%d' % (VER_MAJOR, VER_MINOR, VER_PATCH)
BUILD_DATE = time.strftime("%y%m%d")
if RELEASE:
# Post-release build
FULL_VERSION = '%s-%s' % (VERSION, BUILD_DATE)
else:
# Pre-release build
if GIT_REVISION != '':
FULL_VERSION = '%s.%s+%s' % (VERSION, REL_TYPE, GIT_REVISION[:7])
else:
FULL_VERSION = '%s.%s+%s' % (VERSION, REL_TYPE, BUILD_DATE)
# Generate version file
ver_py = """# AUTOGENERATED DURING BUILD
ver_sem = '{version}'
ver_full = '{full_version}'
build_date = '{build}'
git_revision = '{git_revision}'
"""
with open(filename, 'w') as f:
f.write(ver_py.format(version=VERSION, full_version=FULL_VERSION,
build=BUILD_DATE, git_revision=GIT_REVISION))
return VERSION, FULL_VERSION
def build_package():
# Generate version file
version, full_version = generate_ver()
# Setup Metadata
setup_meta = dict(
# Application name:
name='labtronyx-gui',
# Version number
version=full_version,
# Application author details:
author="Kevin Kennedy",
author_email="protonyx@users.noreply.github.com",
# License
license="MIT",
# Details
url="https://github.com/protonyx/labtronyx-gui",
# Description
description='Labtronyx Instrument Control GUI',
# Platforms
platforms=["Windows", "Mac OS-X", "Linux"],
# Long Description
long_description=open("README.rst").read(),
# Classifiers
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator"
],
# Packages
packages=['labtronyxgui'],
# Package data - e.g. non-python modules
# package_data = {},
# Include additional files into the package
include_package_data=True,
# Dependencies
install_requires=['labtronyx', 'numpy'],
# Entry Points
entry_points={
'gui_scripts': [
'labtronyx-gui = labtronyxgui.__main__:main'
]
},
# Can the project run from a zip file?
zip_safe = False
)
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# Setuptools
setup(**setup_meta)
if __name__ == '__main__':
build_package()