1
- from distutils .cmd import Command
2
- from distutils .util import execute
3
- import os
4
- import platform
5
- import shutil
6
- from subprocess import call
7
- import warnings
1
+ import setuptools
8
2
9
- from setuptools import setup , find_packages
10
- from setuptools .command .develop import develop
11
- from setuptools .command .install import install
12
3
4
+ with open ("README.md" , "r" ) as fh :
5
+ long_description = fh .read ()
13
6
14
- def udev_reload_rules ():
15
- call (["udevadm" , "control" , "--reload-rules" ])
16
-
17
-
18
- def udev_trigger ():
19
- call ( # nosec
20
- [
21
- "udevadm" ,
22
- "trigger" ,
23
- "--subsystem-match=usb" ,
24
- "--attr-match=idVendor=04d8" ,
25
- "--action=add" ,
26
- ]
27
- )
28
-
29
-
30
- def install_udev_rules ():
31
- shutil .copy ("99-pslab.rules" , "/lib/udev/rules.d" )
32
- execute (udev_reload_rules , [], "Reloading udev rules" )
33
- execute (udev_trigger , [], "Triggering udev rules" )
34
-
35
-
36
- def check_root ():
37
- return os .geteuid () == 0
38
-
39
-
40
- class CustomInstall (install ):
41
- def run (self ):
42
- install .run (self )
43
- self .run_command ("udev" )
44
-
45
-
46
- class CustomDevelop (develop ):
47
- def run (self ):
48
- develop .run (self )
49
- try :
50
- self .run_command ("udev" )
51
- except OSError as e :
52
- warnings .warn (e )
53
-
54
-
55
- class InstallUdevRules (Command ):
56
- description = "install udev rules (requires root privileges)."
57
- user_options = []
58
-
59
- def initialize_options (self ):
60
- pass
61
-
62
- def finalize_options (self ):
63
- pass
64
-
65
- def run (self ):
66
- if platform .system () == "Linux" :
67
- if check_root ():
68
- install_udev_rules ()
69
- else :
70
- msg = "You must have root privileges to install udev rules."
71
- raise OSError (msg )
72
-
73
-
74
- setup (
75
- name = "PSL" ,
76
- version = "1.1.0" ,
7
+ setuptools .setup (
8
+ name = "pslab" ,
9
+ version = "2.0.0.dev2" ,
77
10
description = "Pocket Science Lab by FOSSASIA" ,
11
+ long_description = long_description ,
12
+ long_description_content_type = "text/markdown" ,
78
13
author = "FOSSASIA PSLab Developers" ,
79
14
author_email = "pslab-fossasia@googlegroups.com" ,
80
15
url = "https://pslab.io/" ,
81
16
install_requires = ["numpy>=1.16.3" , "pyserial>=3.4" , "scipy>=1.3.0" ],
82
- packages = find_packages (exclude = ("tests" ,)),
17
+ python_requires = ">=3.6" ,
18
+ packages = setuptools .find_packages (exclude = ("tests" ,)),
83
19
package_data = {
84
20
"" : [
85
21
"*.css" ,
@@ -95,9 +31,10 @@ def run(self):
95
31
"99-pslab.rules" ,
96
32
]
97
33
},
98
- cmdclass = {
99
- "develop" : CustomDevelop ,
100
- "install" : CustomInstall ,
101
- "udev" : InstallUdevRules ,
102
- },
34
+ classifiers = [
35
+ "Programming Language :: Python :: 3" ,
36
+ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)" ,
37
+ "Operating System :: OS Independent" ,
38
+ "Development Status :: 4 - Beta" ,
39
+ ],
103
40
)
0 commit comments