Skip to content

Commit 37fa6ea

Browse files
committed
Update installation instructions
Update travis
1 parent 8ad491f commit 37fa6ea

File tree

4 files changed

+82
-80
lines changed

4 files changed

+82
-80
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ before_install:
1313
install:
1414
- pip3 install flake8 -r requirements.txt
1515
- flake8 . --select=E9,F63,F7,F82 --show-source --statistics
16-
- sudo env "PATH=$PATH" make clean
17-
- make all
18-
- sudo env "PATH=$PATH" make install
16+
- sudo python setup.py install
1917

2018
script: nosetests

Makefile

Lines changed: 0 additions & 35 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ To install PSLab on Debian based GNU/Linux system, the following dependencies mu
2626

2727
### Dependencies
2828

29-
* Python 3.4 or higher [Link to Official download page](https://www.python.org/downloads/windows/)
29+
* Python 3.6 or higher [Link to Official download page](https://www.python.org/downloads/windows/)
3030
* Pip   **Support package installer**
3131
* NumPy   **For numerical calculations**
3232
* PySerial   **For device connection**
@@ -36,17 +36,11 @@ To install PSLab on Debian based GNU/Linux system, the following dependencies mu
3636

3737
### How To Install on Linux
3838

39-
cd into the directories
39+
As root (or with sudo):
4040

41-
$ cd <SOURCE_DIR>
41+
# pip install git+https://github.com/fossasia/pslab-python@master
4242

43-
and run the following
44-
45-
$ sudo make clean
46-
$ sudo make
47-
$ sudo make install
48-
49-
Now you are ready with the PSLab software on your machine.
43+
Done!
5044

5145
### How to Install on Windows
5246

setup.py

Lines changed: 77 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
#!/usr/bin/env python
2-
from __future__ import print_function
3-
1+
from distutils.cmd import Command
2+
from distutils.util import execute
43
import os
4+
import platform
55
import shutil
6-
from distutils.util import execute
76
from subprocess import call
7+
import warnings
88

99
from setuptools import setup, find_packages
10+
from setuptools.command.develop import develop
1011
from setuptools.command.install import install
1112

1213

@@ -15,20 +16,21 @@ def udev_reload_rules():
1516

1617

1718
def udev_trigger():
18-
call(["udevadm", "trigger", "--subsystem-match=usb", "--attr-match=idVendor=04d8", "--action=add"])
19+
call(
20+
[
21+
"udevadm",
22+
"trigger",
23+
"--subsystem-match=usb",
24+
"--attr-match=idVendor=04d8",
25+
"--action=add",
26+
]
27+
)
1928

2029

21-
def install_udev_rules(raise_exception):
22-
if check_root():
23-
shutil.copy('99-pslab.rules', '/etc/udev/rules.d')
24-
execute(udev_reload_rules, [], "Reloading udev rules")
25-
execute(udev_trigger, [], "Triggering udev rules")
26-
else:
27-
msg = "You must have root privileges to install udev rules. Run 'sudo python setup.py install'"
28-
if raise_exception:
29-
raise OSError(msg)
30-
else:
31-
print(msg)
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")
3234

3335

3436
def check_root():
@@ -37,22 +39,65 @@ def check_root():
3739

3840
class CustomInstall(install):
3941
def run(self):
40-
if not hasattr(self, "root"):
41-
install_udev_rules(True)
42-
elif self.root is not None:
43-
if 'debian' not in self.root:
44-
install_udev_rules(True)
4542
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)
4672

4773

48-
setup(name='PSL',
49-
version='1.1.0',
50-
description='Pocket Science Lab by FOSSASIA',
51-
author='FOSSASIA PSLab Developers',
52-
author_email='pslab-fossasia@googlegroups.com',
53-
url='https://pslab.io/',
54-
install_requires=['numpy>=1.16.3.', 'pyqtgraph>=0.9.10'],
55-
packages=find_packages(),
56-
package_data={'': ['*.css', '*.png', '*.gif', '*.html', '*.css', '*.js', '*.png', '*.jpg', '*.jpeg', '*.htm',
57-
'99-pslab.rules']},
58-
cmdclass={'install': CustomInstall})
74+
setup(
75+
name="PSL",
76+
version="1.1.0",
77+
description="Pocket Science Lab by FOSSASIA",
78+
author="FOSSASIA PSLab Developers",
79+
author_email="pslab-fossasia@googlegroups.com",
80+
url="https://pslab.io/",
81+
install_requires=["numpy>=1.16.3."],
82+
packages=find_packages(),
83+
package_data={
84+
"": [
85+
"*.css",
86+
"*.png",
87+
"*.gif",
88+
"*.html",
89+
"*.css",
90+
"*.js",
91+
"*.png",
92+
"*.jpg",
93+
"*.jpeg",
94+
"*.htm",
95+
"99-pslab.rules",
96+
]
97+
},
98+
cmdclass={
99+
"develop": CustomDevelop,
100+
"install": CustomInstall,
101+
"udev": InstallUdevRules,
102+
},
103+
)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy