]>
crepu.dev Git - config.git/blob - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/setuptools/command/install_scripts.py
1 from distutils
import log
2 import distutils
.command
.install_scripts
as orig
3 from distutils
.errors
import DistutilsModuleError
7 from pkg_resources
import Distribution
, PathMetadata
8 from .._path
import ensure_directory
11 class install_scripts(orig
.install_scripts
):
12 """Do normal script install, plus any egg_info wrapper scripts"""
14 def initialize_options(self
):
15 orig
.install_scripts
.initialize_options(self
)
19 import setuptools
.command
.easy_install
as ei
21 self
.run_command("egg_info")
22 if self
.distribution
.scripts
:
23 orig
.install_scripts
.run(self
) # run first to set up self.outfiles
27 # don't install entry point scripts into .egg file!
30 ei_cmd
= self
.get_finalized_command("egg_info")
32 ei_cmd
.egg_base
, PathMetadata(ei_cmd
.egg_base
, ei_cmd
.egg_info
),
33 ei_cmd
.egg_name
, ei_cmd
.egg_version
,
35 bs_cmd
= self
.get_finalized_command('build_scripts')
36 exec_param
= getattr(bs_cmd
, 'executable', None)
38 bw_cmd
= self
.get_finalized_command("bdist_wininst")
39 is_wininst
= getattr(bw_cmd
, '_is_running', False)
40 except (ImportError, DistutilsModuleError
):
42 writer
= ei
.ScriptWriter
44 exec_param
= "python.exe"
45 writer
= ei
.WindowsScriptWriter
46 if exec_param
== sys
.executable
:
47 # In case the path to the Python executable contains a space, wrap
48 # it so it's not split up.
49 exec_param
= [exec_param
]
50 # resolve the writer to the environment
51 writer
= writer
.best()
52 cmd
= writer
.command_spec_class
.best().from_param(exec_param
)
53 for args
in writer
.get_args(dist
, cmd
.as_header()):
54 self
.write_script(*args
)
56 def write_script(self
, script_name
, contents
, mode
="t", *ignored
):
57 """Write an executable file to the scripts directory"""
58 from setuptools
.command
.easy_install
import chmod
, current_umask
60 log
.info("Installing %s script to %s", script_name
, self
.install_dir
)
61 target
= os
.path
.join(self
.install_dir
, script_name
)
62 self
.outfiles
.append(target
)
64 mask
= current_umask()
66 ensure_directory(target
)
67 f
= open(target
, "w" + mode
)
70 chmod(target
, 0o777 - mask
)