Skip to content

Commit

Permalink
w
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernrennfanz committed Jul 2, 2024
1 parent b8d0439 commit 17c514b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,11 @@ jobs:
run: |
cd pylon-installer
ren Basler-pylon-*.exe Basler-pylon.exe
Start-Process Basler-pylon.exe -Wait -ArgumentList '/quiet /install=GigE_Support;USB_Support;Camera_Link_Support;CoaXPress_Support;GenTL_Consumer_Support;CamEmu_Support;SDKs;DataProcessing_SDK'
$process = Start-Process Basler-pylon.exe -Wait -ArgumentList '/quiet /install=GigE_Support;USB_Support;Camera_Link_Support;CoaXPress_Support;GenTL_Consumer_Support;CamEmu_Support;SDKs;DataProcessing_SDK' -PassThru
Write-Host "Process finished with return code: " $process.ExitCode
- name: Build wheels
uses: pypa/[email protected]
env:
PYLON_DEV_DIR: "C:\\Program Files\\Basler\\pylon 7\\Development"

- uses: actions/upload-artifact@v3
with:
Expand All @@ -204,7 +203,7 @@ jobs:

build-macos:
needs: setup
runs-on: macos-11
runs-on: macos-latest
strategy:
fail-fast: false
steps:
Expand Down
34 changes: 26 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,16 +530,34 @@ def __init__(self):
if not self.PylonDevDir:
# Fallback, try to locate pylon installation via registry key
import winreg
hkey_local_machine_reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
try:
pylon_registry_key = winreg.OpenKey(hkey_local_machine_reg, r'SOFTWARE\Basler\pylon')
pylon_install_folder = winreg.QueryValue(pylon_registry_key, "InstallationFolder")
try:
current_version = winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Windows\CurrentVersion')
program_files_dir = winreg.QueryValueEx(current_version, "ProgramFilesDir")[0]
print(program_files_dir)
print(os.path.exists(os.path.join(program_files_dir, "Basler", "pylon 7", "Development")))
except OSError as error:
print("ProgramFiles OSError:", error)

try:
# First try the 64-bit node
print("1")
basler_pylon_registry_key = winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Basler\pylon')
except FileNotFoundError:
# Fallback to the 32-bit on 64-bit node
print("2")
basler_pylon_registry_key = winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\WOW6432Node\Basler\pylon')

# Read install location from registry entry
basler_pylon_install_folder = winreg.QueryValueEx(basler_pylon_registry_key, "InstallationFolder")[0]
# Check if install folder contain "Development" folder.
pylon_dev_dir = os.path.join(pylon_install_folder, "Development")
if os.path.exists(pylon_dev_dir):
self.PylonDevDir = pylon_dev_dir
except EnvironmentError:
pass
basler_pylon_install_dev_dir = os.path.join(basler_pylon_install_folder, "Development")
print("InstallDir:", basler_pylon_install_dev_dir)
if os.path.exists(basler_pylon_install_dev_dir):
self.PylonDevDir = basler_pylon_install_dev_dir
except OSError as error:
print("Basler Installdir OSError:", error)

# Throw exception if registry fallback failed.
if not self.PylonDevDir:
raise EnvironmentError("PYLON_DEV_DIR is not set")
Expand Down

0 comments on commit 17c514b

Please sign in to comment.