Commit 734508a72726c2346c3f359efc4e0ce0766f8acb
1 parent
ba30549a
Exists in
dev
Fixing issues for PYROSW with Windows OS, Adding venv option actions (running py…
…ros in actual venv) if there is one and we're not within docker's pyros container
Showing
1 changed file
with
21 additions
and
4 deletions
Show diff stats
PYROSW.py
... | ... | @@ -107,15 +107,32 @@ if DOCKER_OUT_CONTAINER: |
107 | 107 | # cd docker/ |
108 | 108 | os.chdir('docker') |
109 | 109 | # docker-compose up -d |
110 | - res = subprocess.run("docker exec -it pyros python3 pyros.py",stdout=subprocess.DEVNULL) | |
110 | + res = subprocess.run("docker exec -it pyros python3 pyros.py",shell=True,stdout=subprocess.DEVNULL) | |
111 | 111 | if res.returncode != 0: |
112 | 112 | run('docker-compose up -d') |
113 | 113 | sleep(5) |
114 | 114 | PYROS_CMD = 'docker exec -it pyros ' + PYROS_CMD |
115 | 115 | |
116 | -# PYROS_CMD | |
117 | -print("\n Executing command :", PYROS_CMD, "\n") | |
118 | -res = run(PYROS_CMD) | |
116 | +if VENV: | |
117 | + does_venv_folder_exists = os.path.exists("./venv") | |
118 | + print(does_venv_folder_exists) | |
119 | + print(WITH_DOCKER_IS_SET) | |
120 | + if not does_venv_folder_exists and not WITH_DOCKER_IS_SET: | |
121 | + print("No virtual environment available.") | |
122 | + exit(0) | |
123 | + path_to_bin_folder = "" | |
124 | + print("\n Executing command in venv :", PYROS_CMD, "\n") | |
125 | + if os.name == "posix": | |
126 | + res = run(f"./venv/venv_py3_pyros/"+PYROS_CMD) | |
127 | + elif os.name == "nt": | |
128 | + res = run("./venv/venv_py3_pyros/Scripts/python.exe pyros.py "+ args) | |
129 | + else: | |
130 | + # java | |
131 | + pass | |
132 | +else: | |
133 | + # PYROS_CMD | |
134 | + print("\n Executing command :", PYROS_CMD, "\n") | |
135 | + res = run(PYROS_CMD) | |
119 | 136 | |
120 | 137 | ''' |
121 | 138 | #Print the stdout and stderr | ... | ... |