Make a Python package using setup.py
This commit is contained in:
parent
b9a5c577a0
commit
13101e1159
20 changed files with 81 additions and 77 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -1,10 +1,6 @@
|
|||
.idea/
|
||||
storage/sqlite_db
|
||||
storage/sqlite_db_edit
|
||||
backend/1-5_raw_output.log
|
||||
build
|
||||
*.log
|
||||
some_file_location
|
||||
/frontend/static/images/dashboard_histogram.png
|
||||
|
||||
# Compiled python modules.
|
||||
*.pyc
|
||||
|
|
|
|||
29
bin/cosmicpi-postinstall
Executable file
29
bin/cosmicpi-postinstall
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "--- Updating packages"
|
||||
sudo apt --yes update
|
||||
sudo apt --yes upgrade
|
||||
|
||||
echo "--- Installing packages via apt"
|
||||
sudo apt --yes install git htop mosquitto mosquitto-clients
|
||||
|
||||
echo "--- Setting up services"
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable cosmicpi-mqtt.service
|
||||
sudo systemctl enable cosmicpi-dbcleaner.service
|
||||
sudo systemctl enable cosmicpi-detector.service
|
||||
sudo systemctl enable cosmicpi-ui.service
|
||||
|
||||
echo "--- Finished setup! Rebooting now, when this is done your Cosmic Pi should start working ---"
|
||||
echo "--- To connect go to the IP address assigned by your network to the CosmicPi device, or ---"
|
||||
echo "--- cosmicpi.local if you have the correct type of browser. If you are operating in ---"
|
||||
echo "--- stand-alone mode via the CosmicPi wifi network, go directly to 192.168.12.1 ---"
|
||||
echo "--- Note that this Cosmic Pi will automatically publish all cosmic ray and associated ---"
|
||||
echo "--- meta-data (position, accelerometer, magnetometer, temperature, humidity, pressure) ---"
|
||||
echo "--- to the internet for anyone to use under a CC0 license (no rights reserved) ---"
|
||||
echo "--- and placed in the public domain. For license details see: ---"
|
||||
echo "--- https://creativecommons.org/share-your-work/public-domain/cc0/ ---"
|
||||
|
||||
|
||||
sleep 60
|
||||
sudo reboot now
|
||||
2
data_files/dnsmasq.conf
Normal file
2
data_files/dnsmasq.conf
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
interface=wlan0 # Use the require wireless interface - usually wlan0
|
||||
dhcp-range=192.168.12.50,192.168.12.150,255.255.255.0,24h
|
||||
13
install.sh
13
install.sh
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/bash
|
||||
echo "In case of any issues please consult cosmicpi.org for help, or contact us via Facebook "
|
||||
|
||||
echo "--- Part 1: Expand the file system ---"
|
||||
echo "--- Expanding root file system ---"
|
||||
#chmod +x rebootrc.local
|
||||
sudo raspi-config --expand-rootfs
|
||||
#cp -f rebootrc.local /etc/rc.local
|
||||
chmod +x installparttwo.sh
|
||||
|
||||
echo "--- Finished setup part 1! Rebooting, log back in and run sudo ./installparttwo.sh for part 2 ---"
|
||||
sleep 10
|
||||
sudo reboot now
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
echo "--- Part 2: Updates and installation ---"
|
||||
echo "--- Updating packages"
|
||||
sudo apt --yes update
|
||||
sudo apt --yes upgrade
|
||||
|
||||
echo "--- Installing packages via apt"
|
||||
# needed for the CosmicPi software
|
||||
sudo apt --yes install git python-pip htop python-numpy python-matplotlib python-flask mosquitto mosquitto-clients
|
||||
|
||||
echo "--- Installing python packages via pip"
|
||||
sudo pip --no-cache-dir install pyserial configparser flask_googlemaps Flask-BasicAuth --extra-index-url https://www.piwheels.hostedpi.com/simple
|
||||
|
||||
echo "--- Getting executable path"
|
||||
EXECPATH="`dirname \"$0\"`" # relative
|
||||
EXECPATH="`( cd \"$EXECPATH\" && pwd )`" # absolutized and normalized
|
||||
if [ -z "$EXECPATH" ] ; then
|
||||
# error; for some reason, the path is not accessible
|
||||
# to the script (e.g. permissions re-evaled after suid)
|
||||
exit 1 # fail
|
||||
fi
|
||||
echo "$EXECPATH"
|
||||
TOREPLACE="PATH_TO_EXECUTABLE"
|
||||
|
||||
echo "--- Setting up systemd services"
|
||||
sed -i -e "s+$TOREPLACE+$EXECPATH+g" install_files/CosmicPi-mqtt.service
|
||||
sed -i -e "s+$TOREPLACE+$EXECPATH+g" install_files/CosmicPi-database_cleaner.service
|
||||
sed -i -e "s+$TOREPLACE+$EXECPATH+g" install_files/CosmicPi-detector.service
|
||||
sed -i -e "s+$TOREPLACE+$EXECPATH+g" install_files/CosmicPi-UI.service
|
||||
sudo cp -f install_files/*.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable CosmicPi-mqtt.service
|
||||
sudo systemctl enable CosmicPi-database_cleaner.service
|
||||
sudo systemctl enable CosmicPi-detector.service
|
||||
sudo systemctl enable CosmicPi-UI.service
|
||||
#the ap was already done
|
||||
|
||||
echo "--- changing static ip address to 192.168.12.1 in standalone mode---"
|
||||
cp -f dhcpcd.conf /etc/dhcpcd.conf
|
||||
|
||||
#echo"--- preventing this script from running next reboot ---"
|
||||
#chmod +x normalrc.local
|
||||
#sudo cp -f normalrc.local /etc/rc.local
|
||||
|
||||
echo "--- Finished setup! Rebooting now, when this is done your Cosmic Pi should start working ---"
|
||||
echo "--- To connect go to the IP address assigned by your network to the CosmicPi device, or ---"
|
||||
echo "--- cosmicpi.local if you have the correct type of browser. If you are operating in ---"
|
||||
echo "--- stand-alone mode via the CosmicPi wifi network, go directly to 192.168.12.1 ---"
|
||||
echo "--- Note that this Cosmic Pi will automatically publish all cosmic ray and associated ---"
|
||||
echo "--- meta-data (position, accelerometer, magnetometer, temperature, humidity, pressure) ---"
|
||||
echo "--- to the internet for anyone to use under a CC0 license (no rights reserved) ---"
|
||||
echo "--- and placed in the public domain. For license details see: ---"
|
||||
echo "--- https://creativecommons.org/share-your-work/public-domain/cc0/ ---"
|
||||
|
||||
|
||||
sleep 60
|
||||
sudo reboot now
|
||||
49
setup.py
Normal file
49
setup.py
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
from setuptools import setup
|
||||
from setuptools.command.install import install
|
||||
import os
|
||||
|
||||
|
||||
class PostInstall(install):
|
||||
def run(self):
|
||||
install.run(self)
|
||||
os.system('cosmicpi-postinstall')
|
||||
|
||||
|
||||
setup(name='cosmicpi',
|
||||
version='1.5.2',
|
||||
description='Open source cosmic ray detector',
|
||||
long_description='The Cosmic Pi project aims to build the world\'s largest open source distributed cosmic ray telescope. You too can be a part of the project, by becoming a Cosmic Pixel!',
|
||||
platforms=["noarch"],
|
||||
maintainer='Cosmic Pi Team',
|
||||
maintainer_email='info@cosmicpi.org',
|
||||
url='http://cosmicpi.org/',
|
||||
license='GPL V2',
|
||||
packages=[
|
||||
'cosmicpi',
|
||||
'cosmicpi.rest',
|
||||
'cosmicpi.storage',
|
||||
'cosmicpi.ui',
|
||||
],
|
||||
data_files=[
|
||||
# ('/etc/systemd/system/', ['data_files/*.service']),
|
||||
('/etc', ['data_files/cosmicpi.config']),
|
||||
],
|
||||
install_requires=[
|
||||
'numpy',
|
||||
'matplotlib',
|
||||
'flask',
|
||||
'configparser',
|
||||
'pyserial',
|
||||
],
|
||||
scripts=[
|
||||
'bin/cosmicpi-dbcleaner',
|
||||
'bin/cosmicpi-detector',
|
||||
'bin/cosmicpi-mqtt',
|
||||
'bin/cosmicpi-rest',
|
||||
'bin/cosmicpi-ui',
|
||||
'bin/cosmicpi-postinstall',
|
||||
],
|
||||
cmdclass={
|
||||
'install': PostInstall,
|
||||
},
|
||||
)
|
||||
Loading…
Reference in a new issue