forked from pypa/auditwheel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test cases: Unwanted RPATH overwrite and Failing to patch internal no…
…n-py extensions (pypa#134) * Adding minimal test wheel based on PR pypa#134 * Separate tests for each change in PR pypa#134 pypa#134 * non-py extension does not show in auditwheel show (ignoring assert) * Confirming tests on macOS * pytest in travis is weirdly triggering a manual test * Sorry! Forgot to install zlib-devel
- Loading branch information
1 parent
3f308f1
commit f32b1bf
Showing
11 changed files
with
610 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,168 @@ | ||
|
||
# Created by https://www.gitignore.io/api/python,linux,macos | ||
# Edit at https://www.gitignore.io/?templates=python,linux,macos | ||
|
||
### Linux ### | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
### Python Patch ### | ||
.venv/ | ||
|
||
# End of https://www.gitignore.io/api/python,linux,macos |
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,4 @@ | ||
# Python 3 extension example | ||
|
||
This example was inspired from https://gist.github.com/physacco/2e1b52415f3a964ad2a542a99bebed8f | ||
|
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 @@ | ||
testzlib |
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,137 @@ | ||
// Copyright 2007 Timo Bingmann <tb@panthema.net> | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See http://www.boost.org/LICENSE_1_0.txt) | ||
// Taken from https://panthema.net/2007/0328-ZLibString.html | ||
|
||
#include <string.h> | ||
#include <stdexcept> | ||
#include <iostream> | ||
#include <iomanip> | ||
#include <sstream> | ||
|
||
#include <zlib.h> | ||
#include "testzlib.h" | ||
|
||
/** Compress a STL string using zlib with given compression level and return | ||
* the binary data. */ | ||
std::string compress_string(const std::string& str, | ||
int compressionlevel) | ||
{ | ||
z_stream zs; // z_stream is zlib's control structure | ||
memset(&zs, 0, sizeof(zs)); | ||
|
||
if (deflateInit(&zs, compressionlevel) != Z_OK) | ||
throw(std::runtime_error("deflateInit failed while compressing.")); | ||
|
||
zs.next_in = (Bytef*)str.data(); | ||
zs.avail_in = str.size(); // set the z_stream's input | ||
|
||
int ret; | ||
char outbuffer[32768]; | ||
std::string outstring; | ||
|
||
// retrieve the compressed bytes blockwise | ||
do { | ||
zs.next_out = reinterpret_cast<Bytef*>(outbuffer); | ||
zs.avail_out = sizeof(outbuffer); | ||
|
||
ret = deflate(&zs, Z_FINISH); | ||
|
||
if (outstring.size() < zs.total_out) { | ||
// append the block to the output string | ||
outstring.append(outbuffer, | ||
zs.total_out - outstring.size()); | ||
} | ||
} while (ret == Z_OK); | ||
|
||
deflateEnd(&zs); | ||
|
||
if (ret != Z_STREAM_END) { // an error occurred that was not EOF | ||
std::ostringstream oss; | ||
oss << "Exception during zlib compression: (" << ret << ") " << zs.msg; | ||
throw(std::runtime_error(oss.str())); | ||
} | ||
|
||
return outstring; | ||
} | ||
|
||
/** Decompress an STL string using zlib and return the original data. */ | ||
std::string decompress_string(const std::string& str) | ||
{ | ||
z_stream zs; // z_stream is zlib's control structure | ||
memset(&zs, 0, sizeof(zs)); | ||
|
||
if (inflateInit(&zs) != Z_OK) | ||
throw(std::runtime_error("inflateInit failed while decompressing.")); | ||
|
||
zs.next_in = (Bytef*)str.data(); | ||
zs.avail_in = str.size(); | ||
|
||
int ret; | ||
char outbuffer[32768]; | ||
std::string outstring; | ||
|
||
// get the decompressed bytes blockwise using repeated calls to inflate | ||
do { | ||
zs.next_out = reinterpret_cast<Bytef*>(outbuffer); | ||
zs.avail_out = sizeof(outbuffer); | ||
|
||
ret = inflate(&zs, 0); | ||
|
||
if (outstring.size() < zs.total_out) { | ||
outstring.append(outbuffer, | ||
zs.total_out - outstring.size()); | ||
} | ||
|
||
} while (ret == Z_OK); | ||
|
||
inflateEnd(&zs); | ||
|
||
if (ret != Z_STREAM_END) { // an error occurred that was not EOF | ||
std::ostringstream oss; | ||
oss << "Exception during zlib decompression: (" << ret << ") " | ||
<< zs.msg; | ||
throw(std::runtime_error(oss.str())); | ||
} | ||
|
||
return outstring; | ||
} | ||
|
||
/** Small dumb tool (de)compressing cin to cout. It holds all input in memory, | ||
* so don't use it for huge files. */ | ||
int main(int argc, char* argv[]) | ||
{ | ||
std::string allinput; | ||
|
||
while (std::cin.good()) // read all input from cin | ||
{ | ||
char inbuffer[32768]; | ||
std::cin.read(inbuffer, sizeof(inbuffer)); | ||
allinput.append(inbuffer, std::cin.gcount()); | ||
} | ||
|
||
if (argc >= 2 && strcmp(argv[1], "-d") == 0) | ||
{ | ||
std::string cstr = decompress_string( allinput ); | ||
|
||
std::cerr << "Inflated data: " | ||
<< allinput.size() << " -> " << cstr.size() | ||
<< " (" << std::setprecision(1) << std::fixed | ||
<< ( ((float)cstr.size() / (float)allinput.size() - 1.0) * 100.0 ) | ||
<< "% increase).\n"; | ||
|
||
std::cout << cstr; | ||
} | ||
else | ||
{ | ||
std::string cstr = compress_string( allinput ); | ||
|
||
std::cerr << "Deflated data: " | ||
<< allinput.size() << " -> " << cstr.size() | ||
<< " (" << std::setprecision(1) << std::fixed | ||
<< ( (1.0 - (float)cstr.size() / (float)allinput.size()) * 100.0) | ||
<< "% saved).\n"; | ||
|
||
std::cout << cstr; | ||
} | ||
} |
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,11 @@ | ||
#include <iostream> | ||
#include <zlib.h> | ||
|
||
#ifndef ZLIB_EXAMPLE // include guard | ||
#define ZLIB_EXAMPLE | ||
|
||
std::string compress_string(const std::string& str, | ||
int compressionlevel = Z_BEST_COMPRESSION); | ||
std::string decompress_string(const std::string& str); | ||
|
||
#endif /* ZLIB_EXAMPLE */ |
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,8 @@ | ||
# compile and run | ||
g++ testzlib.cpp -lz -o testzlib | ||
if [ $? == 0 ]; then | ||
echo Hello Hello Hello Hello Hello Hello! | ./testzlib | ./testzlib -d | ||
fi | ||
# Deflated data: 37 -> 19 (48.6% saved). | ||
# Inflated data: 19 -> 37 (94.7% increase). | ||
# Hello Hello Hello Hello Hello Hello! |
Oops, something went wrong.