This repository has been archived by the owner on Mar 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Upstream wheel refactored and deleted an API we depend on. We would either have to copy in the specific code we need, and potentially make modifications, or vendor in wheel. I chose to vendor in wheel because it is cleaner, and we can go back to upstream if they provide the API we need again. See pypa/wheel#262. Reviewed By: cooperlees Differential Revision: D14146161 fbshipit-source-id: 5f6a3e49ce5c6d19964a3b067ec79ca6985d0d33
- Loading branch information
1 parent
e80d9ed
commit b8f3645
Showing
23 changed files
with
2,968 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,15 +25,20 @@ def get_long_description(): | |
author_email="[email protected]", | ||
url="https://github.com/facebookincubator/xar", | ||
license="BSD", | ||
packages=["xar", "xar.commands"], | ||
packages=[ | ||
"xar", | ||
"xar.commands", | ||
"xar.vendor", | ||
"xar.vendor.wheel", | ||
"xar.vendor.wheel.signatures", | ||
], | ||
install_requires=[ | ||
"pip>=10.0.1", | ||
# Version 34.1 fixes a bug in the dependency resolution. If this is | ||
# causing an problem for you, please open an issue, and we can evaluate | ||
# a workaround. (grep setuptools>=34.1 to see issue) | ||
# https://github.com/pypa/setuptools/commit/8c1f489f09434f42080397367b6491e75f64d838 # noqa: E501 | ||
"setuptools>=34.1", | ||
"wheel<=0.31.1", | ||
], | ||
test_requires=["mock", "pytest"], | ||
classifiers=[ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"wheel" copyright (c) 2012-2014 Daniel Holth <[email protected]> and | ||
contributors. | ||
|
||
The MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a | ||
copy of this software and associated documentation files (the "Software"), | ||
to deal in the Software without restriction, including without limitation | ||
the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
and/or sell copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included | ||
in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# __variables__ with double-quoted values will be available in setup.py: | ||
__version__ = "0.31.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
""" | ||
Wheel command line tool (enable python -m wheel syntax) | ||
""" | ||
|
||
import sys | ||
|
||
|
||
def main(): # needed for console script | ||
if __package__ == '': | ||
# To be able to run 'python wheel-0.9.whl/wheel': | ||
import os.path | ||
path = os.path.dirname(os.path.dirname(__file__)) | ||
sys.path[0:0] = [path] | ||
import wheel.tool | ||
sys.exit(wheel.tool.main()) | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
""" | ||
Archive tools for wheel. | ||
""" | ||
|
||
import os | ||
import os.path | ||
import time | ||
import zipfile | ||
from distutils import log | ||
|
||
|
||
def archive_wheelfile(base_name, base_dir): | ||
"""Archive all files under `base_dir` in a whl file and name it like | ||
`base_name`. | ||
""" | ||
olddir = os.path.abspath(os.curdir) | ||
base_name = os.path.abspath(base_name) | ||
try: | ||
os.chdir(base_dir) | ||
return make_wheelfile_inner(base_name) | ||
finally: | ||
os.chdir(olddir) | ||
|
||
|
||
def make_wheelfile_inner(base_name, base_dir='.'): | ||
"""Create a whl file from all the files under 'base_dir'. | ||
Places .dist-info at the end of the archive.""" | ||
|
||
zip_filename = base_name + ".whl" | ||
|
||
log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) | ||
|
||
# Some applications need reproducible .whl files, but they can't do this | ||
# without forcing the timestamp of the individual ZipInfo objects. See | ||
# issue #143. | ||
timestamp = os.environ.get('SOURCE_DATE_EPOCH') | ||
if timestamp is None: | ||
date_time = None | ||
else: | ||
date_time = time.gmtime(int(timestamp))[0:6] | ||
|
||
score = {'WHEEL': 1, 'METADATA': 2, 'RECORD': 3} | ||
|
||
def writefile(path, date_time): | ||
st = os.stat(path) | ||
if date_time is None: | ||
mtime = time.gmtime(st.st_mtime) | ||
date_time = mtime[0:6] | ||
zinfo = zipfile.ZipInfo(path, date_time) | ||
zinfo.external_attr = st.st_mode << 16 | ||
zinfo.compress_type = zipfile.ZIP_DEFLATED | ||
with open(path, 'rb') as fp: | ||
zip.writestr(zinfo, fp.read()) | ||
log.info("adding '%s'" % path) | ||
|
||
with zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED, | ||
allowZip64=True) as zip: | ||
deferred = [] | ||
for dirpath, dirnames, filenames in os.walk(base_dir): | ||
# Sort the directory names so that `os.walk` will walk them in a | ||
# defined order on the next iteration. | ||
dirnames.sort() | ||
for name in sorted(filenames): | ||
path = os.path.normpath(os.path.join(dirpath, name)) | ||
|
||
if os.path.isfile(path): | ||
if dirpath.endswith('.dist-info'): | ||
deferred.append((score.get(name, 0), path)) | ||
else: | ||
writefile(path, date_time) | ||
|
||
deferred.sort() | ||
for score, path in deferred: | ||
writefile(path, date_time) | ||
|
||
return zip_filename |
Oops, something went wrong.