Skip to content

Commit d484d11

Browse files
Nikokrockenzbang
authored andcommitted
Replace get_script_args call by ScriptWriter.get_script_args
get_script_args is just a variable that point to the class method for backward compatibility. Using the right name ensure the type information can be fetched by mypy.
1 parent 179c95e commit d484d11

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/e3/anod/sandbox/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def get_configuration(self) -> dict:
147147
return yaml.safe_load(f)
148148

149149
def write_scripts(self) -> None:
150-
from setuptools.command.easy_install import get_script_args # type: ignore[attr-defined]
150+
from setuptools.command.easy_install import ScriptWriter
151151

152152
# Retrieve sandbox_scripts entry points
153153
e3_distrib = get_distribution("e3-core")
@@ -161,7 +161,7 @@ def get_entry_map(self, group): # type: ignore
161161
def as_requirement(self): # type: ignore
162162
return e3_distrib.as_requirement()
163163

164-
for script in get_script_args(dist=SandboxDist()):
164+
for script in ScriptWriter.best().get_args(dist=SandboxDist()):
165165
script_name = script[0]
166166
script_content = script[1]
167167
target = os.path.join(self.bin_dir, script_name)
@@ -171,8 +171,8 @@ def as_requirement(self): # type: ignore
171171
"console_scripts", "sandbox_scripts"
172172
)
173173
with open(target, "wb") as f:
174-
if isinstance(script_content, str):
175-
f.write(script_content.encode("utf-8"))
174+
if isinstance(script_content, bytes): # type: ignore[unreachable]
175+
f.write(script_content) # type: ignore[unreachable]
176176
else:
177-
f.write(script_content)
177+
f.write(script_content.encode("utf-8"))
178178
chmod("a+x", target)

0 commit comments

Comments
 (0)