-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script and configs to build Win32 wheel
- Loading branch information
1 parent
2a61257
commit 013005b
Showing
3 changed files
with
74 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,35 @@ | ||
#!/usr/bin/python3 | ||
|
||
import os | ||
import shutil | ||
import subprocess | ||
import tempfile | ||
import glob | ||
|
||
cp = subprocess.run([ | ||
'mingw-ldd', | ||
os.path.dirname(os.path.abspath(__file__)) + '/../.libs/concordance.exe', | ||
'--dll-lookup-dirs', | ||
os.environ['MINGW_SYSROOT_BIN'], | ||
os.path.dirname(os.path.abspath(__file__)) + '/../../libconcord/.libs', | ||
], capture_output=True, check=True, text=True) | ||
with tempfile.TemporaryDirectory() as tempdir: | ||
subdir = os.path.join(tempdir,'libconcord') | ||
os.mkdir(subdir) | ||
for line in cp.stdout.splitlines(): | ||
dll = line.split('=>')[1].strip() | ||
if dll != 'not found': | ||
shutil.copy2(dll, subdir) | ||
shutil.copy2(os.path.dirname(os.path.abspath(__file__)) + '/../.libs/concordance.exe', subdir) | ||
shutil.copy2(os.path.dirname(os.path.abspath(__file__)) + '/../../libconcord/bindings/python/libconcord.py', subdir + '/__init__.py') | ||
shutil.copy2(os.path.dirname(os.path.abspath(__file__)) + '/setup.py.win32-wheel', tempdir + '/setup.py') | ||
shutil.copy2(os.path.dirname(os.path.abspath(__file__)) + '/pyproject.toml.win32-wheel', tempdir + '/pyproject.toml') | ||
|
||
curdir = os.getcwd() | ||
os.chdir(tempdir) | ||
|
||
subprocess.run([ 'python3', '-m', 'build', ]) | ||
for file in glob.glob('dist/*.whl'): | ||
print("Found wheel: " + file) | ||
shutil.copy2(file, os.path.dirname(os.path.abspath(__file__))) | ||
os.chdir(curdir) |
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,3 @@ | ||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" |
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,36 @@ | ||
#!/usr/bin/env python | ||
# | ||
# vim:tw=80:ai:tabstop=4:softtabstop=4:shiftwidth=4:expandtab | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
|
||
from setuptools import setup | ||
|
||
setup( | ||
name='libconcord', | ||
version='1.5', | ||
packages=['libconcord'], | ||
zip_safe=False, | ||
package_data={ | ||
'': ['*.dll', '*.exe'] | ||
}, | ||
options={ | ||
"bdist_wheel": { | ||
"plat_name": "win32", | ||
}, | ||
}, | ||
) | ||
|