Browse Source

Move un/setenv from python backend to utils

tags/1.9.6
falkTX 10 years ago
parent
commit
fe2c0bb9e4
4 changed files with 31 additions and 29 deletions
  1. +0
    -26
      source/carla_backend.py
  2. +2
    -2
      source/carla_database.py
  3. +28
    -0
      source/carla_utils.py
  4. +1
    -1
      source/native-plugins/resources/carla-plugin

+ 0
- 26
source/carla_backend.py View File

@@ -1215,32 +1215,6 @@ class CarlaHostMeta(object):
self.pathBinaries = ""
self.pathResources = ""

# use _putenv on windows
if not WINDOWS:
self.msvcrt = None
return

self.msvcrt = cdll.msvcrt
self.msvcrt._putenv.argtypes = [c_char_p]
self.msvcrt._putenv.restype = None

# set environment variable
def setenv(self, key, value):
environ[key] = value

if WINDOWS:
keyvalue = "%s=%s" % (key, value)
self.msvcrt._putenv(keyvalue.encode("utf-8"))

# unset environment variable
def unsetenv(self, key):
if environ.get(key) is not None:
environ.pop(key)

if WINDOWS:
keyrm = "%s=" % key
self.msvcrt._putenv(keyrm.encode("utf-8"))

# Get how many engine drivers are available.
@abstractmethod
def get_engine_driver_count(self):


+ 2
- 2
source/carla_database.py View File

@@ -1038,9 +1038,9 @@ class PluginRefreshW(QDialog):
self.ui.group_options.setEnabled(False)

if self.ui.ch_do_checks.isChecked():
self.host.unsetenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS")
gCarla.utils.unsetenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS")
else:
self.host.setenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS", "true")
gCarla.utils.setenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS", "true")

native, posix32, posix64, win32, win64 = (self.ui.ch_native.isChecked(),
self.ui.ch_posix32.isChecked(), self.ui.ch_posix64.isChecked(),


+ 28
- 0
source/carla_utils.py View File

@@ -214,6 +214,34 @@ class CarlaUtils(object):
self.lib.carla_pipe_client_destroy.argtypes = [CarlaPipeClientHandle]
self.lib.carla_pipe_client_destroy.restype = None

# use _putenv on windows
if not WINDOWS:
self.msvcrt = None
return

self.msvcrt = cdll.msvcrt
self.msvcrt._putenv.argtypes = [c_char_p]
self.msvcrt._putenv.restype = None

# --------------------------------------------------------------------------------------------------------

# set environment variable
def setenv(self, key, value):
environ[key] = value

if WINDOWS:
keyvalue = "%s=%s" % (key, value)
self.msvcrt._putenv(keyvalue.encode("utf-8"))

# unset environment variable
def unsetenv(self, key):
if environ.get(key) is not None:
environ.pop(key)

if WINDOWS:
keyrm = "%s=" % key
self.msvcrt._putenv(keyrm.encode("utf-8"))

# --------------------------------------------------------------------------------------------------------

# Get the complete license text of used third-party code and features.


+ 1
- 1
source/native-plugins/resources/carla-plugin View File

@@ -461,7 +461,7 @@ if __name__ == '__main__':
except:
winId = 0

host.setenv("CARLA_PLUGIN_EMBED_WINID", "0")
gCarla.utils.setenv("CARLA_PLUGIN_EMBED_WINID", "0")

if LINUX and winId != 0 and not config_UseQt5:
gui = CarlaEmbedW(host, winId)


Loading…
Cancel
Save