File indexing completed on 2024-04-14 15:46:29

0001 #!/usr/bin/env python3
0002 
0003 import subprocess
0004 
0005 from setuptools import setup, find_packages
0006 from setuptools.command.install import install
0007 
0008 VERSION: str = "0.1"
0009 
0010 
0011 class GitLabInstallCommand(install):
0012     """
0013     Customized install command, which allows us to generate a man page
0014     """
0015 
0016     def run(self):
0017         install.run(self)
0018 
0019         help2man_found = False
0020         try:
0021             subprocess.check_call(["which", "help2man"])
0022             help2man_found = True
0023         except subprocess.CalledProcessError:
0024             help2man_found = False
0025 
0026         if help2man_found:
0027             print("Found optional dependency help2man - generating man page")
0028             subprocess.call(
0029                 [
0030                     "help2man",
0031                     "--no-info",
0032                     "--version-string={}".format(VERSION),
0033                     "./git-lab.py",
0034                     "--output",
0035                     "/usr/local/share/man/man1/git-lab.1",
0036                 ]
0037             )
0038         else:
0039             print("Could not find optional dependency help2man - not generating a man page")
0040 
0041 
0042 setup(
0043     name="lab",
0044     version=VERSION,
0045     packages=find_packages(),
0046     cmdclass={
0047         "install": GitLabInstallCommand,
0048     },
0049     entry_points={
0050         "console_scripts": [
0051             "git-lab = lab:main",
0052         ]
0053     },
0054     install_requires=open("requirements.txt").readlines(),
0055 )