Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
3d1134e3
Kaydet (Commit)
3d1134e3
authored
Mar 12, 2014
tarafından
Éric Araujo
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Avoid “error: None” messages from distutils (#4931).
Thanks to Amaury Forgeot d’Arc and Philip J. Eby.
üst
fd0c2f57
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
38 deletions
+20
-38
apiref.rst
Doc/distutils/apiref.rst
+0
-9
core.py
Lib/distutils/core.py
+2
-5
dir_util.py
Lib/distutils/dir_util.py
+1
-3
test_util.py
Lib/distutils/tests/test_util.py
+10
-2
util.py
Lib/distutils/util.py
+4
-19
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/distutils/apiref.rst
Dosyayı görüntüle @
3d1134e3
...
@@ -1167,15 +1167,6 @@ other utility module.
...
@@ -1167,15 +1167,6 @@ other utility module.
underscore. No { } or ( ) style quoting is available.
underscore. No { } or ( ) style quoting is available.
.. function:: grok_environment_error(exc[, prefix='error: '])
Generate a useful error message from an :exc:`EnvironmentError` (:exc:`IOError`
or :exc:`OSError`) exception object. Handles Python 1.5.1 and later styles,
and does what it can to deal with exception objects that don't have a filename
(which happens when the error is due to a two-file operation, such as
:func:`~os.rename` or :func:`~os.link`). Returns the error message as a
string prefixed with *prefix*.
.. function:: split_quoted(s)
.. function:: split_quoted(s)
...
...
Lib/distutils/core.py
Dosyayı görüntüle @
3d1134e3
...
@@ -14,7 +14,6 @@ import os
...
@@ -14,7 +14,6 @@ import os
from
distutils.debug
import
DEBUG
from
distutils.debug
import
DEBUG
from
distutils.errors
import
(
DistutilsSetupError
,
DistutilsArgError
,
from
distutils.errors
import
(
DistutilsSetupError
,
DistutilsArgError
,
DistutilsError
,
CCompilerError
)
DistutilsError
,
CCompilerError
)
from
distutils.util
import
grok_environment_error
# Mainly import these so setup scripts can "from distutils.core import" them.
# Mainly import these so setup scripts can "from distutils.core import" them.
from
distutils.dist
import
Distribution
from
distutils.dist
import
Distribution
...
@@ -153,13 +152,11 @@ def setup(**attrs):
...
@@ -153,13 +152,11 @@ def setup(**attrs):
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
raise
SystemExit
,
"interrupted"
raise
SystemExit
,
"interrupted"
except
(
IOError
,
os
.
error
),
exc
:
except
(
IOError
,
os
.
error
),
exc
:
error
=
grok_environment_error
(
exc
)
if
DEBUG
:
if
DEBUG
:
sys
.
stderr
.
write
(
error
+
"
\n
"
)
sys
.
stderr
.
write
(
"error:
%
s
\n
"
%
(
exc
,)
)
raise
raise
else
:
else
:
raise
SystemExit
,
e
rror
raise
SystemExit
,
e
xc
except
(
DistutilsError
,
except
(
DistutilsError
,
CCompilerError
),
msg
:
CCompilerError
),
msg
:
...
...
Lib/distutils/dir_util.py
Dosyayı görüntüle @
3d1134e3
...
@@ -185,7 +185,6 @@ def remove_tree(directory, verbose=1, dry_run=0):
...
@@ -185,7 +185,6 @@ def remove_tree(directory, verbose=1, dry_run=0):
Any errors are ignored (apart from being reported to stdout if 'verbose'
Any errors are ignored (apart from being reported to stdout if 'verbose'
is true).
is true).
"""
"""
from
distutils.util
import
grok_environment_error
global
_path_created
global
_path_created
if
verbose
>=
1
:
if
verbose
>=
1
:
...
@@ -202,8 +201,7 @@ def remove_tree(directory, verbose=1, dry_run=0):
...
@@ -202,8 +201,7 @@ def remove_tree(directory, verbose=1, dry_run=0):
if
abspath
in
_path_created
:
if
abspath
in
_path_created
:
del
_path_created
[
abspath
]
del
_path_created
[
abspath
]
except
(
IOError
,
OSError
),
exc
:
except
(
IOError
,
OSError
),
exc
:
log
.
warn
(
grok_environment_error
(
log
.
warn
(
"error removing
%
s:
%
s"
,
directory
,
exc
)
exc
,
"error removing
%
s: "
%
directory
))
def
ensure_relative
(
path
):
def
ensure_relative
(
path
):
"""Take the full path 'path', and make it a relative path.
"""Take the full path 'path', and make it a relative path.
...
...
Lib/distutils/tests/test_util.py
Dosyayı görüntüle @
3d1134e3
...
@@ -3,8 +3,9 @@ import sys
...
@@ -3,8 +3,9 @@ import sys
import
unittest
import
unittest
from
test.test_support
import
run_unittest
from
test.test_support
import
run_unittest
from
distutils.errors
import
DistutilsPlatformError
,
DistutilsByteCompileError
from
distutils.errors
import
DistutilsByteCompileError
from
distutils.util
import
byte_compile
from
distutils.util
import
byte_compile
,
grok_environment_error
class
UtilTestCase
(
unittest
.
TestCase
):
class
UtilTestCase
(
unittest
.
TestCase
):
...
@@ -18,6 +19,13 @@ class UtilTestCase(unittest.TestCase):
...
@@ -18,6 +19,13 @@ class UtilTestCase(unittest.TestCase):
finally
:
finally
:
sys
.
dont_write_bytecode
=
old_dont_write_bytecode
sys
.
dont_write_bytecode
=
old_dont_write_bytecode
def
test_grok_environment_error
(
self
):
# test obsolete function to ensure backward compat (#4931)
exc
=
IOError
(
"Unable to find batch file"
)
msg
=
grok_environment_error
(
exc
)
self
.
assertEqual
(
msg
,
"error: Unable to find batch file"
)
def
test_suite
():
def
test_suite
():
return
unittest
.
makeSuite
(
UtilTestCase
)
return
unittest
.
makeSuite
(
UtilTestCase
)
...
...
Lib/distutils/util.py
Dosyayı görüntüle @
3d1134e3
...
@@ -213,25 +213,10 @@ def subst_vars (s, local_vars):
...
@@ -213,25 +213,10 @@ def subst_vars (s, local_vars):
def
grok_environment_error
(
exc
,
prefix
=
"error: "
):
def
grok_environment_error
(
exc
,
prefix
=
"error: "
):
"""Generate a useful error message from an EnvironmentError (IOError or
# Function kept for backward compatibility.
OSError) exception object. Handles Python 1.5.1 and 1.5.2 styles, and
# Used to try clever things with EnvironmentErrors,
does what it can to deal with exception objects that don't have a
# but nowadays str(exception) produces good messages.
filename (which happens when the error is due to a two-file operation,
return
prefix
+
str
(
exc
)
such as 'rename()' or 'link()'. Returns the error message as a string
prefixed with 'prefix'.
"""
# check for Python 1.5.2-style {IO,OS}Error exception objects
if
hasattr
(
exc
,
'filename'
)
and
hasattr
(
exc
,
'strerror'
):
if
exc
.
filename
:
error
=
prefix
+
"
%
s:
%
s"
%
(
exc
.
filename
,
exc
.
strerror
)
else
:
# two-argument functions in posix module don't
# include the filename in the exception object!
error
=
prefix
+
"
%
s"
%
exc
.
strerror
else
:
error
=
prefix
+
str
(
exc
[
-
1
])
return
error
# Needed by 'split_quoted()'
# Needed by 'split_quoted()'
...
...
Misc/NEWS
Dosyayı görüntüle @
3d1134e3
...
@@ -44,6 +44,9 @@ Library
...
@@ -44,6 +44,9 @@ Library
as
documented
.
The
pattern
and
source
keyword
parameters
are
left
as
as
documented
.
The
pattern
and
source
keyword
parameters
are
left
as
deprecated
aliases
.
deprecated
aliases
.
-
Issue
#
4931
:
distutils
should
not
produce
unhelpful
"error: None"
messages
anymore
.
distutils
.
util
.
grok_environment_error
is
kept
but
doc
-
deprecated
.
-
Improve
the
random
module
's default seeding to use 256 bits of entropy
-
Improve
the
random
module
's default seeding to use 256 bits of entropy
from os.urandom(). This was already done for Python 3, mildly improving
from os.urandom(). This was already done for Python 3, mildly improving
security with a bigger seed space.
security with a bigger seed space.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment