summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-05-01 09:08:16 +0300
committerDevaev Maxim <[email protected]>2019-05-01 09:08:16 +0300
commitf1c86cca4fdd26aa83a239342d022152fc1f4b8a (patch)
tree369d7d8f7e64f6f2d6b0d4500a3f85bd89aab543 /setup.py
parent374ff9cf9ea463b4d49227f89c5798d249330fd0 (diff)
better setup.py
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/setup.py b/setup.py
index a3a84994..83605e49 100755
--- a/setup.py
+++ b/setup.py
@@ -24,16 +24,27 @@
import os
import textwrap
+import setuptools.command.easy_install
from setuptools import setup
-from setuptools.command.easy_install import ScriptWriter
# =====
-def main() -> None:
+class _ScriptWriter(setuptools.command.easy_install.ScriptWriter):
+ template = textwrap.dedent("""
+ # EASY-INSTALL-ENTRY-SCRIPT: {spec},{group},{name}
+
+ __requires__ = "{spec}"
+
+ from {module} import main
+
+ if __name__ == "__main__":
+ main()
+ """).strip()
+
+ @classmethod
def get_args(cls, dist, header=None): # type: ignore
if header is None:
header = cls.get_header()
-
spec = str(dist.as_requirement())
for group_type in ["console", "gui"]:
group = group_type + "_scripts"
@@ -45,21 +56,14 @@ def main() -> None:
name=name,
module=ep.module_name,
)
- args = cls._get_script_args(group_type, name, header, script_text)
- for res in args:
- yield res
-
- ScriptWriter.get_args = classmethod(get_args)
- ScriptWriter.template = textwrap.dedent("""
- # EASY-INSTALL-ENTRY-SCRIPT: {spec},{group},{name}
+ yield from cls._get_script_args(group_type, name, header, script_text)
- __requires__ = "{spec}"
-
- from {module} import main
- if __name__ == "__main__":
- main()
- """).strip()
+# =====
+def main() -> None:
+ setuptools.command.easy_install.ScriptWriter = _ScriptWriter
+ setuptools.command.easy_install.get_script_args = _ScriptWriter.get_script_args
+ setuptools.command.easy_install.get_script_header = _ScriptWriter.get_script_header
setup(
name="kvmd",