Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c1b7e7f8
Commit
c1b7e7f8
authored
Sep 18, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A few style changes originally done in the distutils2 repo
parent
f30b5ae6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
17 deletions
+16
-17
Lib/packaging/command/build_scripts.py
Lib/packaging/command/build_scripts.py
+2
-2
Lib/packaging/create.py
Lib/packaging/create.py
+3
-2
Lib/shutil.py
Lib/shutil.py
+4
-4
Lib/test/test_sysconfig.py
Lib/test/test_sysconfig.py
+7
-9
No files found.
Lib/packaging/command/build_scripts.py
View file @
c1b7e7f8
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
os
import
os
import
re
import
re
import
sysconfig
import
sysconfig
import
tokenize
from
tokenize
import
detect_encoding
from
packaging.command.cmd
import
Command
from
packaging.command.cmd
import
Command
from
packaging.util
import
convert_path
,
newer
from
packaging.util
import
convert_path
,
newer
...
@@ -83,7 +83,7 @@ class build_scripts(Command, Mixin2to3):
...
@@ -83,7 +83,7 @@ class build_scripts(Command, Mixin2to3):
raise
raise
f
=
None
f
=
None
else
:
else
:
encoding
,
lines
=
tokenize
.
detect_encoding
(
f
.
readline
)
encoding
,
lines
=
detect_encoding
(
f
.
readline
)
f
.
seek
(
0
)
f
.
seek
(
0
)
first_line
=
f
.
readline
()
first_line
=
f
.
readline
()
if
not
first_line
:
if
not
first_line
:
...
...
Lib/packaging/create.py
View file @
c1b7e7f8
...
@@ -25,10 +25,11 @@ import sys
...
@@ -25,10 +25,11 @@ import sys
import
glob
import
glob
import
shutil
import
shutil
import
sysconfig
import
sysconfig
import
tokenize
from
hashlib
import
md5
from
hashlib
import
md5
from
textwrap
import
dedent
from
textwrap
import
dedent
from
tokenize
import
detect_encoding
from
configparser
import
RawConfigParser
from
configparser
import
RawConfigParser
# importing this with an underscore as it should be replaced by the
# importing this with an underscore as it should be replaced by the
# dict form or another structures for all purposes
# dict form or another structures for all purposes
from
packaging._trove
import
all_classifiers
as
_CLASSIFIERS_LIST
from
packaging._trove
import
all_classifiers
as
_CLASSIFIERS_LIST
...
@@ -111,7 +112,7 @@ def load_setup():
...
@@ -111,7 +112,7 @@ def load_setup():
been loaded before, because we are monkey patching its setup function with
been loaded before, because we are monkey patching its setup function with
a particular one"""
a particular one"""
with
open
(
"setup.py"
,
"rb"
)
as
f
:
with
open
(
"setup.py"
,
"rb"
)
as
f
:
encoding
,
lines
=
tokenize
.
detect_encoding
(
f
.
readline
)
encoding
,
lines
=
detect_encoding
(
f
.
readline
)
with
open
(
"setup.py"
,
encoding
=
encoding
)
as
f
:
with
open
(
"setup.py"
,
encoding
=
encoding
)
as
f
:
imp
.
load_module
(
"setup"
,
f
,
"setup.py"
,
(
".py"
,
"r"
,
imp
.
PY_SOURCE
))
imp
.
load_module
(
"setup"
,
f
,
"setup.py"
,
(
".py"
,
"r"
,
imp
.
PY_SOURCE
))
...
...
Lib/shutil.py
View file @
c1b7e7f8
...
@@ -391,7 +391,7 @@ def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
...
@@ -391,7 +391,7 @@ def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
compress_ext
[
'bzip2'
]
=
'.bz2'
compress_ext
[
'bzip2'
]
=
'.bz2'
# flags for compression program, each element of list will be an argument
# flags for compression program, each element of list will be an argument
if
compress
is
not
None
and
compress
not
in
compress_ext
.
keys
()
:
if
compress
is
not
None
and
compress
not
in
compress_ext
:
raise
ValueError
(
"bad value for 'compress', or compression format not "
raise
ValueError
(
"bad value for 'compress', or compression format not "
"supported : {0}"
.
format
(
compress
))
"supported : {0}"
.
format
(
compress
))
...
@@ -497,7 +497,7 @@ _ARCHIVE_FORMATS = {
...
@@ -497,7 +497,7 @@ _ARCHIVE_FORMATS = {
'gztar'
:
(
_make_tarball
,
[(
'compress'
,
'gzip'
)],
"gzip'ed tar-file"
),
'gztar'
:
(
_make_tarball
,
[(
'compress'
,
'gzip'
)],
"gzip'ed tar-file"
),
'bztar'
:
(
_make_tarball
,
[(
'compress'
,
'bzip2'
)],
"bzip2'ed tar-file"
),
'bztar'
:
(
_make_tarball
,
[(
'compress'
,
'bzip2'
)],
"bzip2'ed tar-file"
),
'tar'
:
(
_make_tarball
,
[(
'compress'
,
None
)],
"uncompressed tar file"
),
'tar'
:
(
_make_tarball
,
[(
'compress'
,
None
)],
"uncompressed tar file"
),
'zip'
:
(
_make_zipfile
,
[],
"ZIP file"
)
'zip'
:
(
_make_zipfile
,
[],
"ZIP file"
)
}
}
if
_BZ2_SUPPORTED
:
if
_BZ2_SUPPORTED
:
...
@@ -530,7 +530,7 @@ def register_archive_format(name, function, extra_args=None, description=''):
...
@@ -530,7 +530,7 @@ def register_archive_format(name, function, extra_args=None, description=''):
if
not
isinstance
(
extra_args
,
(
tuple
,
list
)):
if
not
isinstance
(
extra_args
,
(
tuple
,
list
)):
raise
TypeError
(
'extra_args needs to be a sequence'
)
raise
TypeError
(
'extra_args needs to be a sequence'
)
for
element
in
extra_args
:
for
element
in
extra_args
:
if
not
isinstance
(
element
,
(
tuple
,
list
))
or
len
(
element
)
!=
2
:
if
not
isinstance
(
element
,
(
tuple
,
list
))
or
len
(
element
)
!=
2
:
raise
TypeError
(
'extra_args elements are : (arg_name, value)'
)
raise
TypeError
(
'extra_args elements are : (arg_name, value)'
)
_ARCHIVE_FORMATS
[
name
]
=
(
function
,
extra_args
,
description
)
_ARCHIVE_FORMATS
[
name
]
=
(
function
,
extra_args
,
description
)
...
@@ -682,7 +682,7 @@ def _unpack_zipfile(filename, extract_dir):
...
@@ -682,7 +682,7 @@ def _unpack_zipfile(filename, extract_dir):
if
not
name
.
endswith
(
'/'
):
if
not
name
.
endswith
(
'/'
):
# file
# file
data
=
zip
.
read
(
info
.
filename
)
data
=
zip
.
read
(
info
.
filename
)
f
=
open
(
target
,
'wb'
)
f
=
open
(
target
,
'wb'
)
try
:
try
:
f
.
write
(
data
)
f
.
write
(
data
)
finally
:
finally
:
...
...
Lib/test/test_sysconfig.py
View file @
c1b7e7f8
...
@@ -39,7 +39,7 @@ class TestSysConfig(unittest.TestCase):
...
@@ -39,7 +39,7 @@ class TestSysConfig(unittest.TestCase):
self
.
_config_vars
=
copy
(
sysconfig
.
_CONFIG_VARS
)
self
.
_config_vars
=
copy
(
sysconfig
.
_CONFIG_VARS
)
self
.
_added_envvars
=
[]
self
.
_added_envvars
=
[]
self
.
_changed_envvars
=
[]
self
.
_changed_envvars
=
[]
for
var
in
(
'MACOSX_DEPLOYMENT_TARGET'
,
'P
ath
'
):
for
var
in
(
'MACOSX_DEPLOYMENT_TARGET'
,
'P
ATH
'
):
if
var
in
os
.
environ
:
if
var
in
os
.
environ
:
self
.
_changed_envvars
.
append
((
var
,
os
.
environ
[
var
]))
self
.
_changed_envvars
.
append
((
var
,
os
.
environ
[
var
]))
else
:
else
:
...
@@ -87,21 +87,19 @@ class TestSysConfig(unittest.TestCase):
...
@@ -87,21 +87,19 @@ class TestSysConfig(unittest.TestCase):
scheme
=
get_paths
()
scheme
=
get_paths
()
default_scheme
=
_get_default_scheme
()
default_scheme
=
_get_default_scheme
()
wanted
=
_expand_vars
(
default_scheme
,
None
)
wanted
=
_expand_vars
(
default_scheme
,
None
)
wanted
=
list
(
wanted
.
items
())
wanted
=
sorted
(
wanted
.
items
())
wanted
.
sort
()
scheme
=
sorted
(
scheme
.
items
())
scheme
=
list
(
scheme
.
items
())
scheme
.
sort
()
self
.
assertEqual
(
scheme
,
wanted
)
self
.
assertEqual
(
scheme
,
wanted
)
def
test_get_path
(
self
):
def
test_get_path
(
self
):
#
xxx
make real tests here
#
XXX
make real tests here
for
scheme
in
_SCHEMES
:
for
scheme
in
_SCHEMES
:
for
name
in
_SCHEMES
[
scheme
]:
for
name
in
_SCHEMES
[
scheme
]:
res
=
get_path
(
name
,
scheme
)
res
=
get_path
(
name
,
scheme
)
def
test_get_config_vars
(
self
):
def
test_get_config_vars
(
self
):
cvars
=
get_config_vars
()
cvars
=
get_config_vars
()
self
.
assert
True
(
isinstance
(
cvars
,
dict
)
)
self
.
assert
IsInstance
(
cvars
,
dict
)
self
.
assertTrue
(
cvars
)
self
.
assertTrue
(
cvars
)
def
test_get_platform
(
self
):
def
test_get_platform
(
self
):
...
@@ -236,8 +234,8 @@ class TestSysConfig(unittest.TestCase):
...
@@ -236,8 +234,8 @@ class TestSysConfig(unittest.TestCase):
# On Windows, the EXE needs to know where pythonXY.dll is at so we have
# On Windows, the EXE needs to know where pythonXY.dll is at so we have
# to add the directory to the path.
# to add the directory to the path.
if
sys
.
platform
==
"win32"
:
if
sys
.
platform
==
"win32"
:
os
.
environ
[
"P
ath
"
]
=
"{};{}"
.
format
(
os
.
environ
[
"P
ATH
"
]
=
"{};{}"
.
format
(
os
.
path
.
dirname
(
sys
.
executable
),
os
.
environ
[
"P
ath
"
])
os
.
path
.
dirname
(
sys
.
executable
),
os
.
environ
[
"P
ATH
"
])
# Issue 7880
# Issue 7880
def
get
(
python
):
def
get
(
python
):
...
...
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