Skip to content

Commit 11e3a63

Browse files
author
Pan
committed
Windows wheel fixes for bundled libraries.
1 parent 8f7607e commit 11e3a63

File tree

3 files changed

+41
-15
lines changed

3 files changed

+41
-15
lines changed

.appveyor.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ environment:
66
CMD_IN_ENV: "cmd /E:ON /V:ON /C %APPVEYOR_BUILD_FOLDER%\\ci\\appveyor\\run_with_env.cmd"
77
PYTHONUNBUFFERED: 1
88
EMBEDDED_LIB: 1
9+
OPENSSL_VER: 1.0.2l
910
PYPI_USER:
1011
secure: 2m0jy6JD/R9RExIosOT6YA==
1112
PYPI_PASS:
@@ -15,41 +16,49 @@ environment:
1516
PYTHON_VERSION: "2.7"
1617
PYTHON_ARCH: "32"
1718
MSVC: "Visual Studio 9"
19+
ARCH: i386
1820

1921
- PYTHON: "C:\\Python27-x64"
2022
PYTHON_VERSION: "2.7"
2123
PYTHON_ARCH: "64"
2224
MSVC: "Visual Studio 9"
25+
ARCH: x64_86
2326

2427
- PYTHON: "C:\\Python34"
2528
PYTHON_VERSION: "3.4"
2629
PYTHON_ARCH: "32"
2730
MSVC: "Visual Studio 10"
31+
ARCH: i386
2832

2933
- PYTHON: "C:\\Python34-x64"
3034
PYTHON_VERSION: "3.4"
3135
PYTHON_ARCH: "64"
3236
MSVC: "Visual Studio 10 Win64"
37+
ARCH: x64_86
3338

3439
- PYTHON: "C:\\Python35"
3540
PYTHON_VERSION: "3.5"
3641
PYTHON_ARCH: "32"
3742
MSVC: "Visual Studio 14"
43+
ARCH: i386
3844

3945
- PYTHON: "C:\\Python35-x64"
4046
PYTHON_VERSION: "3.5"
4147
PYTHON_ARCH: "64"
4248
MSVC: "Visual Studio 14 Win64"
49+
ARCH: x64_86
4350

4451
- PYTHON: "C:\\Python36"
4552
PYTHON_VERSION: "3.6"
4653
PYTHON_ARCH: "32"
4754
MSVC: "Visual Studio 14"
55+
ARCH: i386
4856

4957
- PYTHON: "C:\\Python36-x64"
5058
PYTHON_VERSION: "3.6"
5159
PYTHON_ARCH: "64"
5260
MSVC: "Visual Studio 14 Win64"
61+
ARCH: x64_86
5362

5463
install:
5564
# If there is a newer build queued for the same PR, cancel this one.
@@ -91,6 +100,11 @@ install:
91100
# do not cause a version change.
92101
- python ci/appveyor/fix_version.py .
93102
- mv -f .git .git.bak
103+
- appveyor DownloadFile https://indy.fulgan.com/SSL/openssl-%OPENSSL_VER%-%ARCH%-win%PYTHON_ARCH%.zip
104+
- 7z x openssl-%OPENSSL_VER%-%ARCH%-win%PYTHON_ARCH%.zip
105+
- cp ssleay32.dll ssh2\
106+
- cp libeay32.dll ssh2\
107+
- ps: ls ssh2
94108

95109
build_script:
96110
# Build the compiled extension
@@ -112,4 +126,4 @@ artifacts:
112126
- path: "*.whl"
113127

114128
deploy_script:
115-
- python ci/appveyor/pypi_upload.py *.whl
129+
- IF "%APPVEYOR_REPO_TAG%" == "true"( python ci/appveyor/pypi_upload.py *.whl )

ci/appveyor/build_ssh2.bat

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,43 @@
11
mkdir src && cd src
22

3+
IF "%PYTHON_ARCH%" == "32" (
4+
set OPENSSL_DIR="C:\OpenSSL-Win32"
5+
) ELSE (
6+
set OPENSSL_DIR="C:\OpenSSL-Win64"
7+
)
8+
9+
ls %OPENSSL_DIR%\lib
10+
ls %OPENSSL_DIR%\lib\VC
11+
ls %OPENSSL_DIR%\lib\VC\static
12+
313
IF "%MSVC%" == "Visual Studio 9" (
414
ECHO "Building without platform set"
515
cmake ..\libssh2 -G "NMake Makefiles" ^
616
-DCMAKE_BUILD_TYPE=Release ^
717
-DCRYPTO_BACKEND=OpenSSL ^
8-
-DBUILD_SHARED_LIBS=OFF
18+
-DBUILD_SHARED_LIBS=OFF ^
19+
-DOPENSSL_ROOT_DIR=%OPENSSL_DIR%
20+
REM -DOPENSSL_MSVC_STATIC_RT=TRUE
21+
REM -DOPENSSL_USE_STATIC_LIBS=TRUE
922
) ELSE (
1023
ECHO "Building with platform %MSVC%"
1124
cmake ..\libssh2 -G "NMake Makefiles" ^
1225
-DCMAKE_BUILD_TYPE=Release ^
1326
-DCRYPTO_BACKEND=OpenSSL ^
1427
-G"%MSVC%" ^
15-
-DBUILD_SHARED_LIBS=OFF
16-
)
17-
18-
IF "%PYTHON_ARCH%" == "32" (
19-
set OPENSSL_DIR="C:\OpenSSL-Win32"
20-
) ELSE (
21-
set OPENSSL_DIR="C:\OpenSSL-Win64"
28+
-DBUILD_SHARED_LIBS=OFF ^
29+
-DOPENSSL_ROOT_DIR=%OPENSSL_DIR%
30+
REM -DOPENSSL_MSVC_STATIC_RT=TRUE
31+
REM -DOPENSSL_USE_STATIC_LIBS=TRUE
2232
)
2333

2434
cp %OPENSSL_DIR%\lib\VC\libeay32MD.lib %APPVEYOR_BUILD_FOLDER%
2535
cp %OPENSSL_DIR%\lib\VC\ssleay32MD.lib %APPVEYOR_BUILD_FOLDER%
26-
cp %OPENSSL_DIR%\libeay32.dll %APPVEYOR_BUILD_FOLDER%\ssh2\
27-
cp %OPENSSL_DIR%\ssleay32.dll %APPVEYOR_BUILD_FOLDER%\ssh2\
36+
REM cp %OPENSSL_DIR%\libeay32.dll %APPVEYOR_BUILD_FOLDER%\ssh2\
37+
REM cp %OPENSSL_DIR%\ssleay32.dll %APPVEYOR_BUILD_FOLDER%\ssh2\
2838

2939
cmake --build . --config Release
3040
cd ..
31-
ls %OPENSSL_DIR%\
3241
ls
3342
ls ssh2
3443
ls src/src

setup.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@
2727
if ON_WINDOWS:
2828
# For libssh2 OpenSSL backend on Windows.
2929
_libs = ['Ws2_32', 'libssh2', 'user32',
30-
'libeay32MD', 'ssleay32MD']
30+
'libeay32MD', 'ssleay32MD',
31+
]
3132
else:
3233
_libs = ['ssh2']
3334

3435
# _comp_args = ["-ggdb"]
35-
_comp_args = ["-O3"] if platform.system() != 'Windows' else None
36+
_comp_args = ["-O3"] if not ON_WINDOWS else None
3637
_embedded_lib = bool(os.environ.get('EMBEDDED_LIB', 1))
3738
cython_directives = {'embedsignature': True,
3839
'boundscheck': False,
@@ -57,7 +58,9 @@
5758
package_data = {'ssh2': ['*.pxd']}
5859

5960
if ON_WINDOWS:
60-
package_data['ssh2'].extend(['libeay32.dll', 'ssleay32.dll'])
61+
package_data['ssh2'].extend([
62+
'libeay32.dll', 'ssleay32.dll',
63+
])
6164

6265
print("Using package data %s" % package_data)
6366

0 commit comments

Comments
 (0)