-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
51 lines (43 loc) · 1.69 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
#!/usr/bin/env python
from __future__ import print_function
#from distutils.core import setup
from setuptools import setup, find_packages
from setuptools.command.install import install
import os,shutil
from distutils.util import execute
from distutils.cmd import Command
from subprocess import call
def udev_reload_rules():
call(["udevadm", "control", "--reload-rules"])
def udev_trigger():
call(["udevadm", "trigger", "--subsystem-match=usb","--attr-match=idVendor=04d8", "--action=add"])
def install_udev_rules(raise_exception):
if check_root():
shutil.copy('proto.rules', '/etc/udev/rules.d')
execute(udev_reload_rules, [], "Reloading udev rules")
execute(udev_trigger, [], "Triggering udev rules")
else:
msg = "You must have root privileges to install udev rules. Run 'sudo python setup.py install'"
if raise_exception:
raise OSError(msg)
else:
print(msg)
def check_root():
return os.geteuid() == 0
class CustomInstall(install):
def run(self):
if not hasattr(self,"root") or 'debian' not in self.root:
install_udev_rules(True)
install.run(self)
setup(name='SEEL',
version='0.1',
description='Package to deal with vLabtool-version 0',
author='Jithin B.P.',
author_email='[email protected]',
url='https://vlabtool.jithinbp.in',
install_requires = ['numpy>=1.8.1','pyqtgraph>=0.9.10'],
packages=find_packages(),#['Labtools', 'Labtools.widgets'],
#scripts=["SEEL/bin/"+a for a in os.listdir("SEEL/bin/")],
package_data={'': ['*.css','*.png','*.gif','*.html','*.css','*.js','*.png','*.jpg','*.jpeg','*.htm','proto.rules']},
cmdclass={'install': CustomInstall},
)