- cmd='source %s && python3 -c "import sys ; sys.stdout.write(\\"{}.{}\\".format(sys.version_info.major,sys.version_info.minor))"' %(_config["prereq_path"])
- versionPython=subprocess.check_output(['/bin/bash', '-l' ,'-c',cmd]).decode("utf-8")
+ if "python_version" in _config:
+ versionPython_split = _config["python_version"].split('.')
+ versionPython = versionPython_split[0] + "." + versionPython_split[1]
+ else:
+ cmd='source %s && python3 -c "import sys ; sys.stdout.write(\\"{}.{}\\".format(sys.version_info.major,sys.version_info.minor))"' %(_config["prereq_path"])
+ versionPython=subprocess.check_output(['/bin/bash', '-l' ,'-c',cmd]).decode("utf-8")
+
+ venv_directory_path = None
+ if "venv_directory_path" in _config:
+ venv_directory_path = _config["venv_directory_path"]
+ venv_bin_directory_path = os.path.join(venv_directory_path, 'bin')
+ venv_pip_executable = os.path.join(venv_bin_directory_path, 'pip')
+ venv_python_executable = os.path.join(venv_bin_directory_path, 'python')
+ if os.path.isdir(venv_directory_path) and os.path.isfile(venv_pip_executable):
+ requirement_file = os.path.join(home_dir, 'requirements.txt')
+ with open(requirement_file, 'w') as fd:
+ subprocess.call([venv_python_executable, '-m', 'pip', 'freeze'], stdout=fd)
+ else:
+ venv_directory_path = None