-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
64 lines (57 loc) · 2.1 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
#!/usr/bin/python3
import os
from setuptools import setup
from setuptools.command.install import install
import stat
class FixPermsInstall(install):
'''Custom install class just to fix permissions for the schema data.'''
def run(self):
'''Fix schema data permissions.'''
install.run(self)
no_exec_mask = ~(stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
for filepath in self.get_outputs():
parent = os.path.basename(os.path.dirname(filepath))
if parent != 'schema':
continue
# Open the file so there's no race between the stat and the
# chmod.
with open(filepath, 'r') as f:
fd = f.fileno()
st = os.fstat(fd)
os.fchmod(fd, st.st_mode & no_exec_mask)
# Keep the long description in sync with the README.
script_dir = os.path.dirname(os.path.realpath(__file__))
readme_path = os.path.join(script_dir, 'README.md')
with open(readme_path, 'r') as f:
long_desc = f.read()
setup(
name='sschema',
version='0.1.6',
description='A library and prebuilt schemas for handling edge sensor data',
long_description=long_desc,
long_description_content_type='text/markdown',
author='Martin Kelly',
author_email='[email protected]',
license='Apache',
python_requires='>=3',
install_requires=[
'PyYAML',
'simpleeval',
'jsonschema'
],
packages=['sschema', 'sschema.handler'],
package_data={'sschema': ['schema/*']},
cmdclass={
'install': FixPermsInstall
},
classifiers=['Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Software Development :: Embedded Systems',
'Topic :: Software Development :: Testing :: Acceptance',
]
)