Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #87 from psyfood/dll
Browse files Browse the repository at this point in the history
ENH, BF: Improved DLL search path configuration and switch back to using pywin32
  • Loading branch information
hoechenberger authored May 13, 2021
2 parents 2be7f69 + 7d2a3aa commit 67ddfbe
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ matrix:
- os: linux
env: PYTHON_VERSION=3.7

- os: linux
env: PYTHON_VERSION=3.8

- os: linux
env: PYTHON_VERSION=3.9

before_install:
- pwd
- ./travis/00_install_miniconda.sh
Expand Down
9 changes: 8 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
Version 2021.1
--------------
* Improve automated DLL search path configuration; the DLLs should be loadable
out-of-the-box in more situations now, including on systems running Python
3.8 and newer.
* Switch back to using `pywin32` instead of `pypiwin32`.

Version 2019.1
------------------
--------------
* Handle non-existent configuration directory

Version 2018.12.13
Expand Down
22 changes: 18 additions & 4 deletions pyqmix/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,30 @@ def find_dll(dll_dir, dll_filename):
dll_dir = appdirs.user_data_dir('QmixSDK', '')
if os.path.exists(os.path.join(dll_dir, dll_filename)):
dll_path = os.path.join(dll_dir, dll_filename)
# Add DLL dir to PATH, otherwise we won't be able to load the DLL.
os.environ['PATH'] += os.pathsep + dll_dir
# Add DLL dir to the DLL search path, otherwise we won't be able to
# load the DLL.
os.environ['PATH'] = dll_dir + os.pathsep + os.environ['PATH']
try:
# Python >= 3.8
os.add_dll_directory(dll_dir)
except NameError:
pass

return dll_path

return None
else:
if os.path.exists(os.path.join(dll_dir, dll_filename)):
dll_path = os.path.join(dll_dir, dll_filename)
# Add DLL dir to PATH, otherwise we won't be able to load the DLL.
os.environ['PATH'] += os.pathsep + dll_dir
# Add DLL dir to the DLL search path, otherwise we won't be able to
# load the DLL.
os.environ['PATH'] = dll_dir + os.pathsep + os.environ['PATH']
try:
# Python >= 3.8
os.add_dll_directory(dll_dir)
except NameError:
pass

return dll_path
else:
return None
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cffi
ruamel.yaml
appdirs
pypiwin32
pywin32
-e .
6 changes: 4 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ classifiers =
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9

[options]
install_requires =
cffi
ruamel.yaml
ruamel.yaml == 0.16.3
appdirs
pypiwin32; platform_system == "Windows"
pywin32; platform_system == "Windows"
future; python_version < '3'

[bdist_wheel]
Expand Down

0 comments on commit 67ddfbe

Please sign in to comment.