Skip to content

Commit 76bf52b

Browse files
committed
Also search for Python system-wide on Windows.
1 parent ad54195 commit 76bf52b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

client_server/cadabra-server.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
#ifdef _WIN32
1212

13-
std::string getRegKey(const std::string& location, const std::string& name)
13+
std::string getRegKey(const std::string& location, const std::string& name, bool system)
1414
{
1515
HKEY key;
1616
TCHAR value[1024];
1717
DWORD bufLen = 1024*sizeof(TCHAR);
1818
long ret;
19-
ret = RegOpenKeyExA(HKEY_CURRENT_USER, location.c_str(), 0, KEY_QUERY_VALUE, &key);
19+
ret = RegOpenKeyExA(system?HKEY_LOCAL_MACHINE:HKEY_CURRENT_USER, location.c_str(), 0, KEY_QUERY_VALUE, &key);
2020
if( ret != ERROR_SUCCESS ){
2121
return std::string();
2222
}
@@ -46,7 +46,9 @@ int main()
4646
std::string pythonhome=Glib::getenv("PYTHONHOME");
4747
std::string pythonpath=Glib::getenv("PYTHONPATH");
4848

49-
std::string s = getRegKey("SOFTWARE\\Python\\PythonCore\\3.7", "");
49+
std::string s = getRegKey("SOFTWARE\\Python\\PythonCore\\3.7", "", false);
50+
if(s=="")
51+
s = getRegKey("SOFTWARE\\Python\\PythonCore\\3.7", "", true);
5052

5153
// Glib::setenv("PYTHONHOME", (pythonhome.size()>0)?(pythonhome+":"):"" + Glib::get_home_dir()+"/Anaconda3");
5254
// Glib::setenv("PYTHONPATH", (pythonpath.size()>0)?(pythonpath+":"):"" + Glib::get_home_dir()+"/Anaconda3");

cmake/packaging.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Logic to build packages (RPM/DEB) using CPack; see https://cmake.org/Wiki/CMake:Packaging_With_CPack
22
#
33

4+
if(MSVC)
5+
set(CPACK_GENERATOR "NSIS")
6+
message("-- This is a Windows system")
7+
endif()
8+
49
set(LINUX_NAME "")
510
if(EXISTS "/etc/redhat-release")
611
file(READ "/etc/redhat-release" LINUX_ISSUE)

0 commit comments

Comments
 (0)