-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
109 lines (93 loc) · 3.79 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env python
"""The setup script."""
import os.path
from setuptools import setup, find_packages
from setuptools.command.install_scripts import install_scripts
from setuptools.command.develop import develop
from pipenv.project import Project
try:
from pipenv.utils.dependencies import convert_deps_to_pip
except ImportError:
from pipenv.utils import convert_deps_to_pip
pfile = Project(chdir=False).parsed_pipfile
requirements = convert_deps_to_pip(pfile['packages'], r=False)
test_requirements = convert_deps_to_pip(pfile['dev-packages'], r=False)
hardlink_names = ("clls", "cllls", "cals", "calls", "callls", "csls", "cslls", "csllls", "csals", "csalls", "csallls")
class CustomInstallScriptsCommand(install_scripts):
"""Customized setuptools install_scripts command - installs hard links to 'cls'."""
def run(self):
## print("Hello, developer, how are you? :)")
## bs_cmd = self.get_finalized_command('build_scripts')
inst_cmd = self.get_finalized_command('install_scripts')
install_scripts.run(self)
## print(bs_cmd.__dict__)
## print(inst_cmd.__dict__)
#post-processing code
for name in hardlink_names:
target = os.path.join(inst_cmd.install_dir, name)
## self.copy_file(os.path.join(bs_cmd.build_dir, "cls"), target)
self.copy_file(os.path.join(inst_cmd.install_dir, "cls"), target, link='hard')
self.outfiles.append(target)
class CustomDevelopCommand(develop):
"""Customized setuptools develop command - installs hard links to 'cls'."""
def run(self):
## print("Hello, developer, how are you? :)")
inst_cmd = self.get_finalized_command('develop')
develop.run(self)
## print(inst_cmd.__dict__)
#post-processing code
for name in hardlink_names:
target = os.path.join(inst_cmd.script_dir, name)
self.copy_file(os.path.join(inst_cmd.script_dir, "cls"), target, link='hard')
## self.outfiles.append(target)
# *** MAINLINE ***
with open('README.md') as readme_file:
readme = readme_file.read()
setup_requirements = ['bumpversion']
setup(
author="Alastair Irvine",
author_email='[email protected]',
python_requires='>=3.4',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Environment :: Console',
'Topic :: Utilities',
'Operating System :: POSIX :: Linux',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Unix Shell',
],
description="c*ls commands that use colour and pipe output to less, with a sensible prompt",
install_requires=requirements,
license="GNU General Public License v2",
long_description=readme,
long_description_content_type='text/markdown',
include_package_data=True,
keywords='cls, ls, less, colour, color',
name='colorls',
packages=find_packages(include=['colorls', 'colorls.*']),
entry_points={
'console_scripts': [
'colorls-cli=colorls.cli:wrapper',
],
},
scripts=['bin/cls'],
cmdclass={
'install_scripts': CustomInstallScriptsCommand,
'develop': CustomDevelopCommand,
},
setup_requires=setup_requirements,
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/unixnut/cls',
version='1.3.0',
zip_safe=False,
)