-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
47 lines (43 loc) · 1.55 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
from setuptools import setup, find_packages
from setuptools.command.install import install
from setuptools.command.develop import develop
import subprocess
import sys
import os
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
install.run(self)
subprocess.call(['sudo', sys.executable, '-m', 'pybcli', 'install-completion-script'])
class PostDevelopCommand(develop):
"""Post-installation for development mode."""
def run(self):
develop.run(self)
python_executable = sys.executable
subprocess.call([python_executable, '-m', 'pybcli', 'install-completion-script'])
class PostUninstallCommand(install):
"""Post-uninstallation for uninstallation mode."""
def run(self):
install.run(self)
completion_file = "/etc/bash_completion.d/pybcli"
if os.path.exists(completion_file):
os.remove(completion_file)
print(f"Bash completion script removed from {completion_file}")
setup(
name='pybcli',
version='0.1.0',
description='CLI tool to manage and execute bash functions locally or over SSH',
author='Saeed Mahameed <[email protected]>',
packages=find_packages(include=['pybcli', 'pybcli.*']),
entry_points={
'console_scripts': [
'bcli=pybcli.pybcli:main', # Correctly reference the main function in pybcli.py
],
},
cmdclass={
'install': PostInstallCommand,
'develop': PostDevelopCommand,
'uninstall': PostUninstallCommand,
},
)