Skip to content

Commit 7d7be03

Browse files
committed
Reference utility functions from _shutil.
1 parent 5e90762 commit 7d7be03

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

setuptools/_shutil.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,9 @@ def rmtree(path, ignore_errors=False, onexc=_auto_chmod):
5151
def rmdir(path, **opts):
5252
if os.path.isdir(path):
5353
rmtree(path, **opts)
54+
55+
56+
def current_umask():
57+
tmp = os.umask(0o022)
58+
os.umask(tmp)
59+
return tmp

setuptools/command/easy_install.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
from .._path import ensure_directory
6262
from .._scripts import CommandSpec, ScriptWriter
63-
from .._shutil import attempt_chmod_verbose as chmod, rmtree as _rmtree
63+
from .._shutil import attempt_chmod_verbose as chmod, current_umask, rmtree as _rmtree
6464
from ..compat import py39, py312
6565

6666
from distutils import dir_util, log
@@ -1954,12 +1954,6 @@ def is_python_script(script_text, filename):
19541954
sys_executable = CommandSpec._sys_executable()
19551955

19561956

1957-
def current_umask():
1958-
tmp = os.umask(0o022)
1959-
os.umask(tmp)
1960-
return tmp
1961-
1962-
19631957
def only_strs(values):
19641958
"""
19651959
Exclude non-str values. Ref #3063.

setuptools/command/install_scripts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def _install_ep_scripts(self):
5858

5959
def write_script(self, script_name, contents, mode: str = "t", *ignored) -> None:
6060
"""Write an executable file to the scripts directory"""
61-
from setuptools.command.easy_install import chmod, current_umask
61+
from .._shutil import attempt_chmod_verbose as chmod, current_umask
6262

6363
log.info("Installing %s script to %s", script_name, self.install_dir)
6464
target = os.path.join(self.install_dir, script_name)

0 commit comments

Comments
 (0)