Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
41112f5a
Commit
41112f5a
authored
Dec 09, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use io.open for future compatibility and consistency
parent
1c7e97f9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
19 deletions
+17
-19
setuptools/command/build_py.py
setuptools/command/build_py.py
+1
-1
setuptools/command/develop.py
setuptools/command/develop.py
+3
-3
setuptools/command/egg_info.py
setuptools/command/egg_info.py
+2
-2
setuptools/command/sdist.py
setuptools/command/sdist.py
+2
-4
setuptools/tests/test_sdist.py
setuptools/tests/test_sdist.py
+9
-9
No files found.
setuptools/command/build_py.py
View file @
41112f5a
...
...
@@ -163,7 +163,7 @@ class build_py(orig.build_py, Mixin2to3):
with
io
.
open
(
init_py
,
'rb'
)
as
f
:
contents
=
f
.
read
()
if
b'declare_namespace'
not
in
f
.
read
()
:
if
b'declare_namespace'
not
in
contents
:
raise
distutils
.
errors
.
DistutilsError
(
"Namespace package problem: %s is a namespace package, but "
"its
\
n
__init__.py does not call declare_namespace()! Please "
...
...
setuptools/command/develop.py
View file @
41112f5a
...
...
@@ -3,6 +3,7 @@ from distutils import log
from
distutils.errors
import
DistutilsError
,
DistutilsOptionError
import
os
import
glob
import
io
from
pkg_resources
import
Distribution
,
PathMetadata
,
normalize_path
from
setuptools.command.easy_install
import
easy_install
...
...
@@ -163,9 +164,8 @@ class develop(easy_install):
for
script_name
in
self
.
distribution
.
scripts
or
[]:
script_path
=
os
.
path
.
abspath
(
convert_path
(
script_name
))
script_name
=
os
.
path
.
basename
(
script_path
)
f
=
open
(
script_path
,
'rU'
)
script_text
=
f
.
read
()
f
.
close
()
with
io
.
open
(
script_path
)
as
strm
:
script_text
=
strm
.
read
()
self
.
install_script
(
dist
,
script_name
,
script_text
,
script_path
)
def
install_wrapper_scripts
(
self
,
dist
):
...
...
setuptools/command/egg_info.py
View file @
41112f5a
...
...
@@ -10,6 +10,7 @@ import distutils.filelist
import
os
import
re
import
sys
import
io
try
:
from
setuptools_svn
import
svn_utils
...
...
@@ -471,10 +472,9 @@ def get_pkg_info_revision():
# a subversion revision
#
if
os
.
path
.
exists
(
'PKG-INFO'
):
f
=
open
(
'PKG-INFO'
,
'rU'
)
with
io
.
open
(
'PKG-INFO'
)
as
f
:
for
line
in
f
:
match
=
re
.
match
(
r"Version:.*-r(\
d+)
\s*$"
,
line
)
if
match
:
return
int
(
match
.
group
(
1
))
f
.
close
()
return
0
setuptools/command/sdist.py
View file @
41112f5a
...
...
@@ -3,6 +3,7 @@ from distutils import log
import
distutils.command.sdist
as
orig
import
os
import
sys
import
io
from
setuptools.compat
import
PY3
from
setuptools.utils
import
cs_path_exists
...
...
@@ -166,11 +167,8 @@ class sdist(orig.sdist):
if
not
os
.
path
.
isfile
(
self
.
manifest
):
return
False
fp
=
open
(
self
.
manifest
,
'rbU'
)
try
:
with
io
.
open
(
self
.
manifest
,
'rb'
)
as
fp
:
first_line
=
fp
.
readline
()
finally
:
fp
.
close
()
return
(
first_line
!=
'# file GENERATED by distutils, do NOT edit
\
n
'
.
encode
())
...
...
setuptools/tests/test_sdist.py
View file @
41112f5a
...
...
@@ -7,6 +7,7 @@ import sys
import
tempfile
import
unicodedata
import
contextlib
import
io
import
pytest
...
...
@@ -81,6 +82,11 @@ def decompose(path):
return
path
def
read_all_bytes
(
filename
):
with
io
.
open
(
filename
,
'rb'
)
as
fp
:
return
fp
.
read
()
class
TestSdistTest
:
def
setup_method
(
self
,
method
):
...
...
@@ -172,9 +178,7 @@ class TestSdistTest:
mm
.
filelist
.
append
(
filename
)
mm
.
write_manifest
()
manifest
=
open
(
mm
.
manifest
,
'rbU'
)
contents
=
manifest
.
read
()
manifest
.
close
()
contents
=
read_all_bytes
(
mm
.
manifest
)
# The manifest should be UTF-8 encoded
u_contents
=
contents
.
decode
(
'UTF-8'
)
...
...
@@ -210,9 +214,7 @@ class TestSdistTest:
# Re-write manifest
mm
.
write_manifest
()
manifest
=
open
(
mm
.
manifest
,
'rbU'
)
contents
=
manifest
.
read
()
manifest
.
close
()
contents
=
read_all_bytes
(
mm
.
manifest
)
# The manifest should be UTF-8 encoded
contents
.
decode
(
'UTF-8'
)
...
...
@@ -248,9 +250,7 @@ class TestSdistTest:
# Re-write manifest
mm
.
write_manifest
()
manifest
=
open
(
mm
.
manifest
,
'rbU'
)
contents
=
manifest
.
read
()
manifest
.
close
()
contents
=
read_all_bytes
(
mm
.
manifest
)
# The manifest should be UTF-8 encoded
contents
.
decode
(
'UTF-8'
)
...
...
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