update setup.py

This commit is contained in:
sinseman44
2020-11-15 11:02:13 +00:00
parent eb920e789b
commit 1aea68a2a7
3 changed files with 19 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
cp -a "install_scripts/piplotter.service" /etc/systemd/system cp -a "inst_scripts/piplotter.service" /etc/systemd/system
chown root:root /etc/systemd/system/piplotter.service chown root:root /etc/systemd/system/piplotter.service
systemctl daemon-reload systemctl daemon-reload

View File

@@ -1,13 +1,26 @@
from setuptools import setup, find_packages
from setuptools.command.install import install from setuptools.command.install import install
from setuptools.command.develop import develop
from setuptools import setup, find_packages
import subprocess import subprocess
import distutils.cmd
import os import os
class CustomInstallCommand(install): class ServiceCommand(distutils.cmd.Command):
"""A custom command to install systemd service """
description = 'Install systemd service'
user_options = []
def initialize_options(self):
"""Set default values for options."""
def finalize_options(self):
"""Post-process options."""
def run(self): def run(self):
install.run(self) """Run command."""
current_dir_path = os.path.dirname(os.path.realpath(__file__)) current_dir_path = os.path.dirname(os.path.realpath(__file__))
create_service_script_path = os.path.join(current_dir_path, 'install_scripts', 'create_service.sh') create_service_script_path = os.path.join(current_dir_path, 'inst_scripts', 'create_service.sh')
subprocess.check_output([create_service_script_path]) subprocess.check_output([create_service_script_path])
with open("README.md", "r") as fh: with open("README.md", "r") as fh:
@@ -24,7 +37,7 @@ setup(
url="https://github.com/sinseman44/PiPlot2D", url="https://github.com/sinseman44/PiPlot2D",
scripts=['piplotter'], scripts=['piplotter'],
cmdclass={ cmdclass={
'install': CustomInstallCommand 'install_service': ServiceCommand
}, },
packages=find_packages(), packages=find_packages(),
classifiers=[ classifiers=[