Commit ffcbf840 authored by Michael Büsch's avatar Michael Büsch

Rename cython and gui environment variables

Signed-off-by: Michael Büsch's avatarMichael Buesch <m@bues.ch>
parent 8bb42b61
......@@ -135,7 +135,7 @@ def main():
import awlsim.cython_helper
if awlsim.cython_helper.shouldUseCython():
printInfo("*** Using accelerated CYTHON core "
"(AWLSIMCYTHON environment variable is set)")
"(AWLSIM_CYTHON environment variable is set)")
exitCode = AwlSimServer.start(listenHost = opt_listen[0],
listenPort = opt_listen[1],
......
......@@ -13,7 +13,7 @@ Nice=-15
ExecStart=@PREFIX@/bin/awlsim-server -l any -w /home/@USER@/.core.awlpro
ExecStartPost=@PREFIX@/bin/awlsim-client -c localhost -r RUN
Environment=PYTHONPATH=@PYTHON_SITE@ AWLSIMCYTHON=1
Environment=PYTHONPATH=@PYTHON_SITE@ AWLSIM_CYTHON=1
[Install]
WantedBy=multi-user.target
......@@ -155,7 +155,7 @@ def run(inputFile):
import awlsim.cython_helper
if awlsim.cython_helper.shouldUseCython():
writeStdout("*** Using accelerated CYTHON core "
"(AWLSIMCYTHON environment variable is set)\n")
"(AWLSIM_CYTHON environment variable is set)\n")
project = Project.fromProjectOrRawAwlFile(inputFile)
......@@ -248,7 +248,7 @@ def runWithServerBackend(inputFile):
if awlsim.cython_helper.shouldUseCython():
printError("The accelerated CYTHON core currently is incompatible "
"with the backend server. Please remove the "
"AWLSIMCYTHON environment variable.")
"AWLSIM_CYTHON environment variable.")
return 1
project = Project.fromProjectOrRawAwlFile(inputFile)
......
......@@ -17,7 +17,7 @@ def __checkCython():
if __useCython is None:
try:
__useCython = int(os.getenv("AWLSIMCYTHON",
__useCython = int(os.getenv("AWLSIM_CYTHON",
str(__USE_CYTHON_NO)))
if __useCython not in (__USE_CYTHON_NO,
__USE_CYTHON_TRY,
......
......@@ -75,8 +75,8 @@ def __autodetectGuiFramework():
urls["pyqt4"],
urls["pyqt5"]))
# The Qt bindings can be set via AWLSIMGUI environment variable.
__guiFramework = os.getenv("AWLSIMGUI", "auto").lower()
# The Qt bindings can be set via AWLSIM_GUI environment variable.
__guiFramework = os.getenv("AWLSIM_GUI", "auto").lower()
# Run Qt autodetection
if __guiFramework == "auto":
......@@ -117,7 +117,7 @@ elif __guiFramework == "pyqt5":
Signal = pyqtSignal
else:
__frameworkError("Unknown GUI framework '%s' requested. "
"Please fix AWLSIMGUI environment variable." %\
"Please fix AWLSIM_GUI environment variable." %\
__guiFramework)
# Helpers for distinction between Qt4 and Qt5 API.
......
......@@ -57,7 +57,7 @@ def usage():
print(" 5: Extremely verbose logging")
print("")
print("Environment variables:")
print(" AWLSIMGUI Select the GUI framework (default 'auto')")
print(" AWLSIM_GUI Select the GUI framework (default 'auto')")
print(" Can be either of:")
print(" auto: Autodetect")
print(" pyside: Use PySide 4")
......
......@@ -37,7 +37,7 @@ if isPyPy or isJython:
if awlsim.cython_helper.shouldUseCython():
print("*** Using accelerated CYTHON core "
"(AWLSIMCYTHON environment variable is set)")
"(AWLSIM_CYTHON environment variable is set)")
from awlsim.gui.qt_bindings import *
......
......@@ -19,8 +19,8 @@ export PYTHONPATH=
export PYTHONSTARTUP=
export PYTHONINSPECT=
export CYTHONPARALLEL=1
export NOCYTHON=0
export AWLSIM_CYTHON=1
export AWLSIM_CYTHON_PARALLEL=1
%:
dh $@ --with python2,python3,pypy --buildsystem=pybuild
......
......@@ -32,7 +32,7 @@ hook_post_checkout()
hook_testbuild()
{
export CYTHONPARALLEL=1
export AWLSIM_CYTHON_PARALLEL=1
default_hook_testbuild "$@"
}
......
......@@ -553,7 +553,7 @@ EOF
sed -i -e '/Package: cython/,/^$/ d' \
debian/control ||\
die "Failed to patch control file"
sed -i -e 's/export NOCYTHON=0/export NOCYTHON=1/' \
sed -i -e 's/export AWLSIM_CYTHON=1/export AWLSIM_CYTHON=0/' \
debian/rules ||\
die "Failed to patch rules file"
fi
......
......@@ -26,7 +26,22 @@ except ImportError as e:
isWindows = os.name.lower() in {"nt", "ce"}
fullBuild = bool(int(os.getenv("AWLSIM_FULL_BUILD", "0")))
def getEnvInt(name, default = 0):
try:
return int(os.getenv(name, "%d" % default))
except ValueError:
return default
def getEnvBool(name, default = False):
return bool(getEnvInt(name, 1 if default else 0))
fullBuild = getEnvBool("AWLSIM_FULL_BUILD")
buildCython = getEnvBool("AWLSIM_CYTHON", True)
cythonParallelBuild = bool(getEnvInt("AWLSIM_CYTHON_PARALLEL", 1) == 1 or\
getEnvInt("AWLSIM_CYTHON_PARALLEL", 1) == sys.version_info[0])
def makedirs(path, mode=0o755):
......@@ -233,14 +248,9 @@ ext_modules = []
extraKeywords = {}
# Try to build the Cython modules. This might fail.
buildCython = True
try:
if int(os.getenv("NOCYTHON", "0")):
print("Skipping build of CYTHON modules due to "
"NOCYTHON environment variable setting.")
buildCython = False
except ValueError:
pass
if not buildCython:
print("Skipping build of CYTHON modules due to "
"AWLSIM_CYTHON=0 environment variable setting.")
if buildCython:
if os.name != "posix":
print("WARNING: Not building CYTHON modules on '%s' platform." %\
......@@ -260,13 +270,6 @@ if buildCython:
print("--> Is Cython installed?")
buildCython = False
if buildCython:
try:
cythonParallelBuild = int(os.getenv("CYTHONPARALLEL", "0"))
except ValueError:
cythonParallelBuild = 0
cythonParallelBuild = bool(cythonParallelBuild == 1 or\
cythonParallelBuild == sys.version_info[0])
if sys.version_info[0] < 3:
# Cython2 build libraries need method pickling
# for parallel build.
......
......@@ -185,18 +185,18 @@ setup_test_environment()
export PYTHONPATH="$i"
break
done
export AWLSIMCYTHON=2
export AWLSIM_CYTHON=2
local interpreter=python2
elif [ "$interpreter" = "cython3" ]; then
for i in "$rootdir"/build/lib.linux-*-3.*; do
export PYTHONPATH="$i"
break
done
export AWLSIMCYTHON=2
export AWLSIM_CYTHON=2
local interpreter=python3
else
export PYTHONPATH=
export AWLSIMCYTHON=
export AWLSIM_CYTHON=
fi
local conf_pythonpath=
......@@ -216,7 +216,7 @@ setup_test_environment()
cleanup_test_environment()
{
export AWLSIMCYTHON=
export AWLSIM_CYTHON=
export PYTHONPATH=
export JYTHONPATH=
......@@ -413,7 +413,7 @@ build_cython2()
}
cd "$rootdir" || die "cd to $rootdir failed"
echo "=== Building awlsim with python2"
CYTHONPARALLEL=1 \
AWLSIM_CYTHON_PARALLEL=1 \
nice -n 5 \
python2 ./setup.py build || die "'python2 ./setup.py build' failed"
return 0
......@@ -427,7 +427,7 @@ build_cython3()
}
cd "$rootdir" || die "cd to $rootdir failed"
echo "=== Building awlsim with python3"
CYTHONPARALLEL=1 \
AWLSIM_CYTHON_PARALLEL=1 \
nice -n 5 \
python3 ./setup.py build || die "'python3 ./setup.py build' failed"
return 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment