Skip to content

Commit

Permalink
Merged PR 26296: Fixed unit tests for linux, removed pylonCXP from py…
Browse files Browse the repository at this point in the history
…pylon wheel.
  • Loading branch information
bjoernrennfanz committed Jun 28, 2024
2 parents 7f2195a + 7481dc2 commit 022a28c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 126 deletions.
11 changes: 0 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class BuildSupport(object):
"gentl",
"extra",
"pylondataprocessing",
"cxp",
}

# Global switch to toggle pylon data processing support on or off
Expand Down Expand Up @@ -457,18 +456,11 @@ class BuildSupportWindows(BuildSupport):
"gentl": [
("PylonGtc_*.dll", ""),
],

"cxp": [
],
}

GENTL_CXP_PRODUCER_DIR = "pylonCXP"
PYLON_DATA_PROCESSING_VTOOLS_DIR = "pylonDataProcessingPlugins"

RuntimeFolders = {
"cxp": [
(GENTL_CXP_PRODUCER_DIR, GENTL_CXP_PRODUCER_DIR, ()),
],
"pylondataprocessing": [
(PYLON_DATA_PROCESSING_VTOOLS_DIR, PYLON_DATA_PROCESSING_VTOOLS_DIR, ("*Editor*.dll",)),
],
Expand All @@ -485,7 +477,6 @@ class BuildSupportWindows(BuildSupport):
DefineMacros = [
("UNICODE", None),
("_UNICODE", None),
("GENTL_CXP_PRODUCER_DIR", gentl_dir_fmt % GENTL_CXP_PRODUCER_DIR),

# let swig share its type information between the 'genicam' and the
# 'pylon' module by using the same name for the type table.
Expand Down Expand Up @@ -702,8 +693,6 @@ class BuildSupportLinux(BuildSupport):
"usb": [
(r"pylon-libusb-.*\.so", ""),
],
"cxp": [
],
}

# up to one symlink per library -> match shared objects only
Expand Down
115 changes: 0 additions & 115 deletions src/pylon/pylon.i
Original file line number Diff line number Diff line change
Expand Up @@ -260,125 +260,10 @@ static void FixPylonDllLoadingIfNecessary()
}
#endif


#ifdef GENTL_CXP_PRODUCER_DIR

// ExtendGenTLPathForCXP extends the GenTL path, so that
// <path to this module>/<GENTL_CXP_PRODUCER_DIR> becomes part of that path.
// While doing that, we do NOT want the resulting path to contain a reference
// to the producer in this pypylon installation AND a reference to the one of
// a Pylon installation that might be present. Therefore we filter out any
// portion of the original path, that also contains GENTL_CXP_PRODUCER_DIR,
// since the directory name for the producer of an installed Pylon will be
// the same.

#ifdef _WIN32

static void ExtendGenTLPathForCXP()
{
#ifdef _WIN64
static const WCHAR gtlp_name[] = L"GENICAM_GENTL64_PATH";
static const WCHAR hack_name[] = L"BSL_PYPYLON_GENICAM_GENTL64_PATH";
#else
static const WCHAR gtlp_name[] = L"GENICAM_GENTL32_PATH";
static const WCHAR hack_name[] = L"BSL_PYPYLON_GENICAM_GENTL32_PATH";
#endif

const DWORD ENV_MAX = UNICODE_STRING_MAX_CHARS;
// ENV_MAX is so large that it should not be allocated on the stack
PWSTR new_PATH = new WCHAR[ENV_MAX];
PWSTR prev_PATH = new WCHAR[ENV_MAX];

// Hack: If this special env var is set, use it as the resulting
// GenTL path.
BOOL ok = GetEnvironmentVariableW(hack_name, new_PATH, ENV_MAX);
if (!ok || new_PATH[0] == 0)
{
// default behaviour

// get module file name and remove file spec
HMODULE hmod = NULL;
GetModuleHandleExW(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
reinterpret_cast<PWSTR>(ExtendGenTLPathForCXP),
&hmod
);
GetModuleFileNameW(hmod, new_PATH, ENV_MAX);
PathRemoveFileSpecW(new_PATH); // also removes trailing '\'

// concatenate 'GENTL_CXP_PRODUCER_DIR'
PWSTR new_end = new_PATH + lstrlenW(new_PATH);
*new_end++ = L'\\';
StrCpyW(new_end, GENTL_CXP_PRODUCER_DIR);
new_end = new_end + lstrlenW(new_end);
*new_end++ = L';';
*new_end = 0;

// append portions of previous path to new path
prev_PATH[0] = 0;
GetEnvironmentVariableW(gtlp_name, prev_PATH, ENV_MAX);
PWSTR portion = prev_PATH;
PWSTR semicolon = StrChrW(portion, L';');
for(;;)
{
if (semicolon)
{
*semicolon = 0;
}

// only add next portion if it does not contain
// GENTL_CXP_PRODUCER_DIR
if (!StrStrIW(portion, GENTL_CXP_PRODUCER_DIR))
{
int len = lstrlenW(portion);
StrCpyW(new_end, portion);
new_end += len;
*new_end++ = L';';
*new_end = 0;
}

if (!semicolon)
{
break;
}
else
{
portion = semicolon + 1;
semicolon = wcschr(portion, L';');
}
}
}

// set new path
SetEnvironmentVariableW(gtlp_name, new_PATH);

#if 0
char msg[1025];
wsprintfA(msg, "%S is now: %S\n", gtlp_name, new_PATH);
OutputDebugStringA(msg);
#endif

delete[] new_PATH;
delete[] prev_PATH;
}

#else // _WIN32

#error You have to implement ExtendGenTLPathForCXP for this platform!

#endif // _WIN32

#endif // GENTL_CXP_PRODUCER_DIR

%}

%init %{

#ifdef GENTL_CXP_PRODUCER_DIR
ExtendGenTLPathForCXP();
#endif

Pylon::PylonInitialize();

// register PylonTerminate on interpreter shutdown
Expand Down
Empty file removed tests/pylon_tests/__init__.py
Empty file.

0 comments on commit 022a28c

Please sign in to comment.