Skip to content

Commit

Permalink
Detect Python version and platform bits for package
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky committed Aug 12, 2016
1 parent fb83031 commit 306b57b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/activate
/activate.bat
PyQt5-tools
/setup.cfg

# https://github.com/github/gitignore/blob/da00310ccba9de9a988cc973ef5238ad2c1460e9/Python.gitignore

Expand Down
24 changes: 22 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,34 @@

import argparse
import os
import platform
import shutil
import stat
import subprocess
import sys


def main():
designer_path = os.path.join('c:/', 'Qt', 'Qt5.7.0', '5.7', 'msvc2015', 'bin', 'designer.exe')
bits = int(platform.architecture()[0][0:2])
print(bits)
if bits == 32:
compiler_dir = 'msvc2015'
elif bits == 64:
compiler_dir = 'msvc2015_64'

qt_bin_path = os.path.join('c:/', 'Qt', 'Qt5.7.0', '5.7', compiler_dir, 'bin')

with open('setup.cfg', 'w') as cfg:
cfg.write(
'''[bdist_wheel]
python-tag = cp{major}{minor}
plat-name = win{bits}'''.format(
major=sys.version_info[0],
minor=sys.version_info[1],
bits=bits)
)

designer_path = os.path.join(qt_bin_path, 'designer.exe')
designer_destination = os.path.join('PyQt5-tools', 'designer')
os.makedirs(designer_destination, exist_ok=True)
shutil.copy(designer_path, designer_destination)
Expand All @@ -20,7 +40,7 @@ def main():
python_dll_path = os.path.join('venv', 'Scripts', 'python35.dll')
shutil.copy(python_dll_path, designer_destination)

windeployqt_path = os.path.join('c:/', 'Qt', 'Qt5.7.0', '5.7', 'msvc2015', 'bin', 'windeployqt.exe'),
windeployqt_path = os.path.join(qt_bin_path, 'windeployqt.exe'),
windeployqt = subprocess.Popen(
[
windeployqt_path,
Expand Down
2 changes: 1 addition & 1 deletion buildinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
'.'.join([str(v) for v in version_numbers])
+ status.prerelease_suffix
# TODO: this is totally cheating, revisit the revision scheme
+ '5'# prerelease_str
+ '6'# prerelease_str
)

directories = [
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
],
keywords='pyqt5 qt designer',
packages=['PyQt5-tools'],
include_package_data=True,
include_package_data=True
# data_files=buildinfo.data_files()
# scripts=[
# {scripts}
Expand Down

0 comments on commit 306b57b

Please sign in to comment.