Skip to content

Commit a78ef00

Browse files
committed
simplify install process
1 parent fa0d634 commit a78ef00

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,13 @@ For installations with over 150 LEDs, don't expect to get good or safe results b
3232
More information on connecting LED strips and PWM/DMA usage is available [here](https://github.com/jgarff/rpi_ws281x).
3333

3434
### Software Setup
35-
Python 3.6 or newer is required.
35+
Python 3.7 or newer is required.
3636

3737
1. `sudo apt-get install scons swig`
3838
2. `git clone --recurse-submodules https://github.com/jackw01/led-control.git`
3939
3. `cd led-control`
40-
4. `cd ledcontrol/driver/rpi_ws281x/`
41-
5. `scons`
42-
6. `cd ../../..`
43-
7. `sudo python3 setup.py develop`
44-
8. `sudo ledcontrol --led_count 150` (add `--led_pixel_order GRBW` if using RGBW LEDs)
40+
4. `sudo python3 setup.py develop`
41+
5. `sudo ledcontrol --led_count 150` (add `--led_pixel_order GRBW` if using RGBW LEDs)
4542

4643
### Command Line Configuration Arguments
4744
Web server and LED hardware parameters must be specified as command line arguments when running ledcontrol.

preinstall

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
cd ledcontrol/driver/rpi_ws281x/ && scons

setup.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22
# -*- coding: utf-8 -*-
33

44
from setuptools import find_packages, setup, Extension
5+
from setuptools.command.develop import develop
6+
from setuptools.command.install import install
7+
from subprocess import check_call
8+
9+
def pre_install():
10+
print('preinstall')
11+
check_call('scons', cwd='ledcontrol/driver/rpi_ws281x/')
12+
13+
class PreDevelopCommand(develop):
14+
def run(self):
15+
pre_install()
16+
develop.run(self)
17+
18+
class PreInstallCommand(install):
19+
def run(self):
20+
pre_install()
21+
install.run(self)
522

623
requirements = [
724
'recordclass>=0.12.0.1',
@@ -36,6 +53,10 @@
3653
'ledcontrol=ledcontrol:main'
3754
]
3855
},
56+
cmdclass={
57+
'develop': PreDevelopCommand,
58+
'install': PreInstallCommand,
59+
},
3960
license='MIT',
4061
classifiers=[
4162
# Trove classifiers

0 commit comments

Comments
 (0)