Working on systemd/launchd installers

This commit is contained in:
Daniel Dayley 2021-07-20 11:33:45 -06:00
parent a64593a772
commit c30206e5c2

View File

@ -1,6 +1,45 @@
from setuptools import setup, find_packages
from setuptools.command.install_scripts import install_scripts
from setuptools.command.install import install
from setuptools.command.develop import develop
from setuptools.command.egg_info import egg_info
import subprocess
import os
import glob
# From https://stackoverflow.com/questions/5932804/set-file-permissions-in-setup-py-file
class CustomInstallCommand(install) :
def run(self) :
# Run the rest of the installer first
install.run(self)
# Create a new subprocess to run the included shell script
current_dir_path = os.path.dirname(os.path.realpath(__file__))
create_service_script_path = os.path.join(current_dir_path, 'install_systemd_service.sh')
subprocess.check_output([create_service_script_path])
# From https://stackoverflow.com/questions/5932804/set-file-permissions-in-setup-py-file
class CustomDevelopCommand(develop) :
def run(self) :
# Run the rest of the installer first
develop.run(self)
# Create a new subprocess to run the included shell script
current_dir_path = os.path.dirname(os.path.realpath(__file__))
create_service_script_path = os.path.join(current_dir_path, 'install_systemd_service.sh')
subprocess.check_output([create_service_script_path])
# From https://stackoverflow.com/questions/5932804/set-file-permissions-in-setup-py-file
class CustomEggInfoCommand(egg_info) :
def run(self) :
# Run the rest of the installer first
egg_info.run(self)
# Create a new subprocess to run the included shell script
current_dir_path = os.path.dirname(os.path.realpath(__file__))
create_service_script_path = os.path.join(current_dir_path, 'install_systemd_service.sh')
subprocess.check_output([create_service_script_path])
files = glob.glob('python-tool/externals/*.py')
setup(name='python-tool',
@ -15,5 +54,6 @@ setup(name='python-tool',
install_requires=['pyyaml', 'vsphere-automation-sdk @ git+https://github.com/vmware/vsphere-automation-sdk-python.git'],
scripts=['bin/python-tool'],
long_description=open('README.md').read(),
zip_safe=True
zip_safe=True,
cmdclass={'install':CustomInstallCommand,'develop':CustomDevelopCommand,'egg_info':CustomEggInfoCommand}
)