-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathsetup.py
77 lines (69 loc) · 2.26 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
from setuptools import setup, find_packages
from setuptools.command.install_scripts import install_scripts as _install_scripts
from pathlib import Path
import os
# Custom command to modify the generated script
class CustomInstallScripts(_install_scripts):
def run(self):
super().run() # Run the standard install_scripts command
# Modify the installed scripts
for script in self.get_outputs():
if os.path.basename(script) == "audiocontrol2":
self.modify_script(script)
def modify_script(self, script_path):
# Read the original script
with open(script_path, "r") as f:
original_content = f.read()
# Replace the dynamic entry point resolution with direct import
custom_content = (
"#!/usr/bin/python3\n"
"from ac2.audiocontrol2 import main\n"
"if __name__ == '__main__':\n"
" main()\n"
)
# Write the modified script
with open(script_path, "w") as f:
f.write(custom_content)
print(f"Customized script: {script_path}")
# Your other setup configuration
description = "Tool to handle multiple audio players"
long_description = Path("README.md").read_text() if Path("README.md").exists() else description
from ac2.version import VERSION
setup(
name="audiocontrol2",
version=VERSION,
description=description,
long_description=long_description,
author="HiFiBerry",
author_email="[email protected]",
url="https://github.com/hifiberry/audiocontrol2",
packages=find_packages(),
install_requires=[
"gevent",
"gevent-websocket",
"socketio",
"bottle",
"expiringdict",
"musicbrainzngs",
"mpd",
"dbus",
"pylast",
"usagecollector",
"netifaces",
"requests",
"evdev",
],
entry_points={
"console_scripts": [
"audiocontrol2=ac2.audiocontrol2:main",
],
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires=">=3.6",
include_package_data=True,
cmdclass={"install_scripts": CustomInstallScripts},
)