Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
slapos.buildout
Commits
bb0ac205
Commit
bb0ac205
authored
Dec 04, 2017
by
Reinout van Rees
Committed by
GitHub
Dec 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #428 from buildout/reinout-wheel-via-setuptools
Install wheels via setuptools, fixes #425
parents
e2f9963a
d36999fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
68 deletions
+31
-68
CHANGES.rst
CHANGES.rst
+10
-1
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+21
-20
src/zc/buildout/tests.py
src/zc/buildout/tests.py
+0
-47
No files found.
CHANGES.rst
View file @
bb0ac205
...
...
@@ -4,7 +4,16 @@ Change History
2.9.7
(
unreleased
)
==================
-
Nothing
changed
yet
.
-
Setuptools
38.2.0
started
supporting
wheels
.
Through
setuptools
,
buildout
now
also
supports
wheels
! You need at least version 38.2.3 to get proper
namespace
support
.
This
setuptools
change
interfered
with
buildout
's recent support for
`buildout.wheel <https://github.com/buildout/buildout.wheel>`_, resulting in
a sudden "Wheels are not supported" error message (see `issue 435
<https://github.com/buildout/buildout/issues/425>`_). Fixed by making
setuptools the default, though you can still use the buildout.wheel if you
want.
2.9.6 (2017-12-01)
...
...
src/zc/buildout/easy_install.py
View file @
bb0ac205
...
...
@@ -37,6 +37,16 @@ import tempfile
import
zc.buildout
import
warnings
try
:
from
setuptools.wheel
import
Wheel
# This is the important import
from
setuptools
import
__version__
as
setuptools_version
# Now we need to check if we have at least 38.2.3 for namespace support.
SETUPTOOLS_SUPPORTS_WHEELS
=
(
pkg_resources
.
SetuptoolsVersion
(
setuptools_version
)
>=
pkg_resources
.
SetuptoolsVersion
(
'38.2.3'
))
except
ImportError
:
SETUPTOOLS_SUPPORTS_WHEELS
=
False
warnings
.
filterwarnings
(
'ignore'
,
'.+is being parsed as a legacy, non PEP 440, version'
)
...
...
@@ -83,9 +93,6 @@ setuptools_path = buildout_and_setuptools_path
FILE_SCHEME
=
re
.
compile
(
'file://'
,
re
.
I
).
match
DUNDER_FILE_PATTERN
=
re
.
compile
(
r"__file__ = '(?P<filename>.+)'$"
)
def
wheel_to_egg
(
dist
,
dest
):
raise
zc
.
buildout
.
UserError
(
"Wheels are not supported"
)
class
_Monkey
(
object
):
def
__init__
(
self
,
module
,
**
kw
):
mdict
=
self
.
_mdict
=
module
.
__dict__
...
...
@@ -1619,25 +1626,19 @@ def unpack_egg(location, dest):
setuptools
.
archive_util
.
unpack_archive
(
location
,
dest
)
WHEEL_
TO_EGG_
WARNING
=
"""
Using unpack_wheel() shim over the deprecated wheel_to_egg() hook.
Please update your wheel extension implementation for one that installs a .whl
handler in %s.UNPACKERS
"""
.
strip
()
%
(
__name__
,)
WHEEL_WARNING
=
"""
*.whl file detected (%s), you'll need setuptools >= 38.2.3 for that
or an extension like buildout.wheel > 0.2.0.
"""
def
unpack_wheel
(
location
,
dest
):
# Deprecated backward compatibility shim. Please do not use.
logger
.
warning
(
WHEEL_TO_EGG_WARNING
)
basename
=
os
.
path
.
basename
(
location
)
dists
=
setuptools
.
package_index
.
distros_for_location
(
location
,
basename
)
# `wheel_to_egg()` might generate zipped eggs, so we have to make sure we
# get unpacked eggs in the end:
tmp_dest
=
tempfile
.
mkdtemp
(
dir
=
dest
)
wheel_to_egg
(
list
(
dists
)[
0
],
tmp_dest
)
[
egg
]
=
glob
.
glob
(
os
.
path
.
join
(
tmp_dest
,
'*.egg'
))
unpack_egg
(
egg
,
dest
)
shutil
.
rmtree
(
tmp_dest
)
if
SETUPTOOLS_SUPPORTS_WHEELS
:
wheel
=
Wheel
(
location
)
wheel
.
install_as_egg
(
os
.
path
.
join
(
dest
,
wheel
.
egg_name
()))
else
:
raise
zc
.
buildout
.
UserError
(
WHEEL_WARNING
%
location
)
UNPACKERS
=
{
'.egg'
:
unpack_egg
,
...
...
src/zc/buildout/tests.py
View file @
bb0ac205
...
...
@@ -3144,52 +3144,6 @@ def test_buildout_doesnt_keep_adding_itself_to_versions():
if
sys
.
platform
==
'win32'
:
del
buildout_honors_umask
# umask on dohs is academic
class
UnitTests
(
unittest
.
TestCase
):
@
property
def
globs
(
self
):
return
self
.
__dict__
def
setUp
(
self
):
easy_install_SetUp
(
self
)
import
setuptools.package_index
setuptools
.
package_index
.
EXTENSIONS
.
append
(
'.whl'
)
import
zc.buildout.easy_install
self
.
orig_wheel_to_egg
=
zc
.
buildout
.
easy_install
.
wheel_to_egg
def
tearDown
(
self
):
import
zc.buildout.easy_install
zc
.
buildout
.
testing
.
buildoutTearDown
(
self
)
import
setuptools.package_index
setuptools
.
package_index
.
EXTENSIONS
.
remove
(
'.whl'
)
zc
.
buildout
.
easy_install
.
wheel_to_egg
=
self
.
orig_wheel_to_egg
def
test_wheel_to_egg
(
self
):
[
egg_name
]
=
[
n
for
n
in
os
.
listdir
(
self
.
sample_eggs
)
if
n
.
startswith
(
'demo-0.3-'
)]
path
=
os
.
path
.
join
(
self
.
sample_eggs
,
egg_name
)
os
.
rename
(
path
,
os
.
path
.
join
(
self
.
sample_eggs
,
'demo-0.3.whl'
))
import
zc.buildout.easy_install
installer
=
zc
.
buildout
.
easy_install
.
Installer
(
os
.
path
.
join
(
self
.
sample_buildout
,
'eggs'
),
index
=
self
.
sample_eggs
)
# Can't install because the original hook is in place:
with
self
.
assertRaises
(
zc
.
buildout
.
UserError
):
installer
.
install
([
'demo'
])
def
wheel_to_egg
(
dist
,
dest
):
newloc
=
os
.
path
.
join
(
dest
,
egg_name
)
shutil
.
copy
(
dist
.
location
,
newloc
)
return
pkg_resources
.
Distribution
.
from_filename
(
newloc
)
zc
.
buildout
.
easy_install
.
wheel_to_egg
=
wheel_to_egg
egg_dir
=
os
.
path
.
join
(
self
.
sample_buildout
,
'eggs'
)
self
.
assertFalse
(
egg_name
in
os
.
listdir
(
egg_dir
))
installer
.
install
([
'demo'
])
self
.
assertTrue
(
egg_name
in
os
.
listdir
(
egg_dir
))
######################################################################
def
create_sample_eggs
(
test
,
executable
=
sys
.
executable
):
...
...
@@ -3769,7 +3723,6 @@ def test_suite():
])
),
doctest.DocFileSuite('
testing_bugfix
.
txt
'),
unittest.makeSuite(UnitTests),
]
docdir = os.path.join(ancestor(__file__, 4), '
doc
')
...
...
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