- Notifications
You must be signed in to change notification settings - Fork 381
Expand file tree
/
Copy pathsetup.py
More file actions
Latest commit
57 lines (47 loc) · 1.56 KB
/
Copy pathsetup.py
File metadata and controls
57 lines (47 loc) · 1.56 KB
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
importos
importsys
importre
importsubprocess
importshlex
try:
fromsetuptoolsimportsetup, find_packages
fromsetuptools.command.installimportinstall
exceptImportError:
fromdistutils.coreimportsetup, find_packages
fromdistutils.command.installimportinstall
VERSION='0.6.4'
defget_tag_version():
cmd='git tag --points-at HEAD'
versions=subprocess.check_output(shlex.split(cmd)).splitlines()
ifnotversions:
returnNone
iflen(versions) !=1:
sys.exit(f"Trying to get tag via git: Expected excactly one tag, got {len(versions)}")
version=versions[0].decode()
ifre.match('^v[0-9]', version):
version=version[1:]
returnversion
classVerifyVersionCommand(install):
""" Custom command to verify that the git tag matches our version """
description='verify that the git tag matches our version'
defrun(self):
tag_version=get_tag_version()
iftag_versionandtag_version!=VERSION:
sys.exit(f"Git tag: {tag} does not match the version of this app: {VERSION}")
setup(
name='websocket_server',
version=VERSION,
packages=find_packages("."),
url='https://github.com/Pithikos/python-websocket-server',
license='MIT',
author='Johan Hanssen Seferidis',
author_email='manossef@gmail.com',
install_requires=[
],
description='A simple fully working websocket-server in Python with no external dependencies',
platforms='any',
cmdclass={
'verify': VerifyVersionCommand,
},
python_requires=">=3.6",
)