summaryrefslogtreecommitdiff
path: root/distutils/command
diff options
context:
space:
mode:
Diffstat (limited to 'distutils/command')
-rw-r--r--distutils/command/bdist_dumb.py2
-rw-r--r--distutils/command/bdist_rpm.py2
-rw-r--r--distutils/command/build_clib.py2
-rw-r--r--distutils/command/build_ext.py10
-rw-r--r--distutils/command/build_py.py4
-rw-r--r--distutils/command/build_scripts.py2
-rw-r--r--distutils/command/clean.py4
-rw-r--r--distutils/command/config.py2
-rw-r--r--distutils/command/install.py4
-rw-r--r--distutils/command/install_egg_info.py3
-rw-r--r--distutils/command/install_scripts.py2
-rw-r--r--distutils/command/register.py16
-rw-r--r--distutils/command/sdist.py6
-rw-r--r--distutils/command/upload.py14
14 files changed, 40 insertions, 33 deletions
diff --git a/distutils/command/bdist_dumb.py b/distutils/command/bdist_dumb.py
index 4afea28c..071da77e 100644
--- a/distutils/command/bdist_dumb.py
+++ b/distutils/command/bdist_dumb.py
@@ -10,7 +10,7 @@ from ..util import get_platform
from ..dir_util import remove_tree, ensure_relative
from ..errors import DistutilsPlatformError
from ..sysconfig import get_python_version
-from distutils import log
+from distutils._log import log
class bdist_dumb(Command):
diff --git a/distutils/command/bdist_rpm.py b/distutils/command/bdist_rpm.py
index 52431438..340527b0 100644
--- a/distutils/command/bdist_rpm.py
+++ b/distutils/command/bdist_rpm.py
@@ -17,7 +17,7 @@ from ..errors import (
DistutilsExecError,
)
from ..sysconfig import get_python_version
-from distutils import log
+from distutils._log import log
class bdist_rpm(Command):
diff --git a/distutils/command/build_clib.py b/distutils/command/build_clib.py
index 442cd54a..f90c5664 100644
--- a/distutils/command/build_clib.py
+++ b/distutils/command/build_clib.py
@@ -18,7 +18,7 @@ import os
from ..core import Command
from ..errors import DistutilsSetupError
from ..sysconfig import customize_compiler
-from distutils import log
+from distutils._log import log
def show_compilers():
diff --git a/distutils/command/build_ext.py b/distutils/command/build_ext.py
index 3019c757..f4c0eccd 100644
--- a/distutils/command/build_ext.py
+++ b/distutils/command/build_ext.py
@@ -22,7 +22,7 @@ from ..sysconfig import get_config_h_filename
from ..dep_util import newer_group
from ..extension import Extension
from ..util import get_platform
-from distutils import log
+from distutils._log import log
from . import py37compat
from site import USER_BASE
@@ -373,7 +373,7 @@ class build_ext(Command):
ext_name, build_info = ext
- log.warn(
+ log.warning(
"old-style (ext_name, build_info) tuple found in "
"ext_modules for extension '%s' "
"-- please convert to Extension instance",
@@ -413,7 +413,9 @@ class build_ext(Command):
# Medium-easy stuff: same syntax/semantics, different names.
ext.runtime_library_dirs = build_info.get('rpath')
if 'def_file' in build_info:
- log.warn("'def_file' element of build info dict " "no longer supported")
+ log.warning(
+ "'def_file' element of build info dict " "no longer supported"
+ )
# Non-trivial stuff: 'macros' split into 'define_macros'
# and 'undef_macros'.
@@ -597,7 +599,7 @@ class build_ext(Command):
# the temp dir.
if self.swig_cpp:
- log.warn("--swig-cpp is deprecated - use --swig-opts=-c++")
+ log.warning("--swig-cpp is deprecated - use --swig-opts=-c++")
if (
self.swig_cpp
diff --git a/distutils/command/build_py.py b/distutils/command/build_py.py
index d3dfbf8b..9f783244 100644
--- a/distutils/command/build_py.py
+++ b/distutils/command/build_py.py
@@ -10,7 +10,7 @@ import glob
from ..core import Command
from ..errors import DistutilsOptionError, DistutilsFileError
from ..util import convert_path
-from distutils import log
+from distutils._log import log
class build_py(Command):
@@ -212,7 +212,7 @@ class build_py(Command):
def check_module(self, module, module_file):
if not os.path.isfile(module_file):
- log.warn("file %s (for module %s) not found", module_file, module)
+ log.warning("file %s (for module %s) not found", module_file, module)
return False
else:
return True
diff --git a/distutils/command/build_scripts.py b/distutils/command/build_scripts.py
index 728535da..87174f6b 100644
--- a/distutils/command/build_scripts.py
+++ b/distutils/command/build_scripts.py
@@ -9,7 +9,7 @@ from distutils import sysconfig
from ..core import Command
from ..dep_util import newer
from ..util import convert_path
-from distutils import log
+from distutils._log import log
import tokenize
shebang_pattern = re.compile('^#!.*python[0-9.]*([ \t].*)?$')
diff --git a/distutils/command/clean.py b/distutils/command/clean.py
index d1b8a206..d6eb3eba 100644
--- a/distutils/command/clean.py
+++ b/distutils/command/clean.py
@@ -7,7 +7,7 @@ Implements the Distutils 'clean' command."""
import os
from ..core import Command
from ..dir_util import remove_tree
-from distutils import log
+from distutils._log import log
class clean(Command):
@@ -64,7 +64,7 @@ class clean(Command):
if os.path.exists(directory):
remove_tree(directory, dry_run=self.dry_run)
else:
- log.warn("'%s' does not exist -- can't clean it", directory)
+ log.warning("'%s' does not exist -- can't clean it", directory)
# just for the heck of it, try to remove the base build directory:
# we might have emptied it right now, but if not we don't care
diff --git a/distutils/command/config.py b/distutils/command/config.py
index e7ae83f1..8bf0e489 100644
--- a/distutils/command/config.py
+++ b/distutils/command/config.py
@@ -15,7 +15,7 @@ import re
from ..core import Command
from ..errors import DistutilsExecError
from ..sysconfig import customize_compiler
-from distutils import log
+from distutils._log import log
LANG_EXT = {"c": ".c", "c++": ".cxx"}
diff --git a/distutils/command/install.py b/distutils/command/install.py
index 9db4ad99..08d2f881 100644
--- a/distutils/command/install.py
+++ b/distutils/command/install.py
@@ -8,7 +8,7 @@ import contextlib
import sysconfig
import itertools
-from distutils import log
+from distutils._log import log
from ..core import Command
from ..debug import DEBUG
from ..sysconfig import get_config_vars
@@ -644,7 +644,7 @@ class install(Command):
self.extra_path = self.distribution.extra_path
if self.extra_path is not None:
- log.warn(
+ log.warning(
"Distribution option extra_path is deprecated. "
"See issue27919 for details."
)
diff --git a/distutils/command/install_egg_info.py b/distutils/command/install_egg_info.py
index ff9f0284..f3e8f344 100644
--- a/distutils/command/install_egg_info.py
+++ b/distutils/command/install_egg_info.py
@@ -10,7 +10,8 @@ import sys
import re
from ..cmd import Command
-from distutils import log, dir_util
+from .. import dir_util
+from .._log import log
class install_egg_info(Command):
diff --git a/distutils/command/install_scripts.py b/distutils/command/install_scripts.py
index d4d3e3f3..ec6ec5ac 100644
--- a/distutils/command/install_scripts.py
+++ b/distutils/command/install_scripts.py
@@ -7,7 +7,7 @@ Python scripts."""
import os
from ..core import Command
-from distutils import log
+from distutils._log import log
from stat import ST_MODE
diff --git a/distutils/command/register.py b/distutils/command/register.py
index 1a62ee3f..55c1045e 100644
--- a/distutils/command/register.py
+++ b/distutils/command/register.py
@@ -7,12 +7,13 @@ Implements the Distutils 'register' command (register with the repository).
import getpass
import io
+import logging
import urllib.parse
import urllib.request
from warnings import warn
from ..core import PyPIRCCommand
-from distutils import log
+from distutils._log import log
class register(PyPIRCCommand):
@@ -153,7 +154,7 @@ We need to know who you are, so please choose either:
3. have the server generate a new password for you (and email it to you), or
4. quit
Your selection [default 1]: ''',
- log.INFO,
+ logging.INFO,
)
choice = input()
if not choice:
@@ -174,7 +175,7 @@ Your selection [default 1]: ''',
auth.add_password(self.realm, host, username, password)
# send the info to the server and report the result
code, result = self.post_to_server(self.build_post_data('submit'), auth)
- self.announce('Server response ({}): {}'.format(code, result), log.INFO)
+ self.announce('Server response ({}): {}'.format(code, result), logging.INFO)
# possibly save the login
if code == 200:
@@ -188,11 +189,11 @@ Your selection [default 1]: ''',
'I can store your PyPI login so future '
'submissions will be faster.'
),
- log.INFO,
+ logging.INFO,
)
self.announce(
'(the login will be stored in %s)' % self._get_rc_file(),
- log.INFO,
+ logging.INFO,
)
choice = 'X'
while choice.lower() not in 'yn':
@@ -265,7 +266,8 @@ Your selection [default 1]: ''',
'''Post a query to the server, and return a string response.'''
if 'name' in data:
self.announce(
- 'Registering {} to {}'.format(data['name'], self.repository), log.INFO
+ 'Registering {} to {}'.format(data['name'], self.repository),
+ logging.INFO,
)
# Build up the MIME payload for the urllib2 POST data
boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
@@ -315,5 +317,5 @@ Your selection [default 1]: ''',
result = 200, 'OK'
if self.show_response:
msg = '\n'.join(('-' * 75, data, '-' * 75))
- self.announce(msg, log.INFO)
+ self.announce(msg, logging.INFO)
return result
diff --git a/distutils/command/sdist.py b/distutils/command/sdist.py
index 86e41e5f..5cfd4c14 100644
--- a/distutils/command/sdist.py
+++ b/distutils/command/sdist.py
@@ -13,7 +13,7 @@ from distutils import file_util
from distutils import archive_util
from ..text_file import TextFile
from ..filelist import FileList
-from distutils import log
+from distutils._log import log
from ..util import convert_path
from ..errors import DistutilsOptionError, DistutilsTemplateError
@@ -481,12 +481,12 @@ class sdist(Command):
msg = "copying files to %s..." % base_dir
if not files:
- log.warn("no files to distribute -- empty manifest?")
+ log.warning("no files to distribute -- empty manifest?")
else:
log.info(msg)
for file in files:
if not os.path.isfile(file):
- log.warn("'%s' not a regular file -- skipping", file)
+ log.warning("'%s' not a regular file -- skipping", file)
else:
dest = os.path.join(base_dir, file)
self.copy_file(file, dest, link=link)
diff --git a/distutils/command/upload.py b/distutils/command/upload.py
index 633273ee..16e15d8b 100644
--- a/distutils/command/upload.py
+++ b/distutils/command/upload.py
@@ -8,13 +8,13 @@ index).
import os
import io
import hashlib
+import logging
from base64 import standard_b64encode
from urllib.request import urlopen, Request, HTTPError
from urllib.parse import urlparse
from ..errors import DistutilsError, DistutilsOptionError
from ..core import PyPIRCCommand
from ..spawn import spawn
-from distutils import log
# PyPI Warehouse supports MD5, SHA256, and Blake2 (blake2-256)
@@ -171,7 +171,7 @@ class upload(PyPIRCCommand):
body = body.getvalue()
msg = "Submitting {} to {}".format(filename, self.repository)
- self.announce(msg, log.INFO)
+ self.announce(msg, logging.INFO)
# build the Request
headers = {
@@ -190,16 +190,18 @@ class upload(PyPIRCCommand):
status = e.code
reason = e.msg
except OSError as e:
- self.announce(str(e), log.ERROR)
+ self.announce(str(e), logging.ERROR)
raise
if status == 200:
- self.announce('Server response ({}): {}'.format(status, reason), log.INFO)
+ self.announce(
+ 'Server response ({}): {}'.format(status, reason), logging.INFO
+ )
if self.show_response:
text = self._read_pypi_response(result)
msg = '\n'.join(('-' * 75, text, '-' * 75))
- self.announce(msg, log.INFO)
+ self.announce(msg, logging.INFO)
else:
msg = 'Upload failed ({}): {}'.format(status, reason)
- self.announce(msg, log.ERROR)
+ self.announce(msg, logging.ERROR)
raise DistutilsError(msg)