computer-use-ootb-internal 0.0.121__py3-none-any.whl → 0.0.122__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- computer_use_ootb_internal/guard_service.py +56 -20
- {computer_use_ootb_internal-0.0.121.dist-info → computer_use_ootb_internal-0.0.122.dist-info}/METADATA +1 -1
- {computer_use_ootb_internal-0.0.121.dist-info → computer_use_ootb_internal-0.0.122.dist-info}/RECORD +5 -5
- {computer_use_ootb_internal-0.0.121.dist-info → computer_use_ootb_internal-0.0.122.dist-info}/WHEEL +0 -0
- {computer_use_ootb_internal-0.0.121.dist-info → computer_use_ootb_internal-0.0.122.dist-info}/entry_points.txt +0 -0
@@ -134,20 +134,54 @@ class GuardService(win32serviceutil.ServiceFramework):
|
|
134
134
|
# --- End Instance Logging ---
|
135
135
|
|
136
136
|
# --- Instance Helper Methods (Moved from module level) ---
|
137
|
+
def get_base_python_executable(self):
|
138
|
+
"""Tries to find python.exe instead of pythonservice.exe if running as service."""
|
139
|
+
service_exe = sys.executable
|
140
|
+
self.log_info(f"get_base_python_executable: sys.executable is {service_exe}")
|
141
|
+
# Normalize path for comparison
|
142
|
+
service_exe_lower = service_exe.lower()
|
143
|
+
|
144
|
+
# Check if running as pythonservice.exe
|
145
|
+
if 'pythonservice.exe' in os.path.basename(service_exe_lower):
|
146
|
+
# Construct expected python.exe path in the same directory
|
147
|
+
dir_name = os.path.dirname(service_exe)
|
148
|
+
potential_python_exe = os.path.join(dir_name, 'python.exe')
|
149
|
+
self.log_info(f"get_base_python_executable: Checking for python.exe at {potential_python_exe}")
|
150
|
+
|
151
|
+
if os.path.exists(potential_python_exe):
|
152
|
+
self.log_info(f"get_base_python_executable: Found python.exe at {potential_python_exe}")
|
153
|
+
# Quote if necessary
|
154
|
+
final_exe = potential_python_exe
|
155
|
+
if " " in final_exe and not final_exe.startswith('"'):
|
156
|
+
return f'"{final_exe}"'
|
157
|
+
return final_exe
|
158
|
+
else:
|
159
|
+
self.log_error(f"get_base_python_executable: Could not find python.exe near pythonservice.exe (checked {potential_python_exe}). Falling back to using {service_exe}.")
|
160
|
+
# Fallback to original sys.executable (quoted if needed)
|
161
|
+
if " " in service_exe and not service_exe.startswith('"'):
|
162
|
+
return f'"{service_exe}"'
|
163
|
+
return service_exe
|
164
|
+
else: # Not running as pythonservice.exe, assume sys.executable is correct
|
165
|
+
self.log_info(f"get_base_python_executable: sys.executable is not pythonservice.exe, using it directly.")
|
166
|
+
if " " in service_exe and not service_exe.startswith('"'):
|
167
|
+
return f'"{service_exe}"'
|
168
|
+
return service_exe
|
169
|
+
|
137
170
|
def get_python_executable(self):
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
return
|
171
|
+
# This method is now just an alias for clarity if needed elsewhere,
|
172
|
+
# but primary logic uses get_base_python_executable directly.
|
173
|
+
# Keep for potential compatibility if anything still calls it.
|
174
|
+
return self.get_base_python_executable()
|
142
175
|
|
143
176
|
def get_pip_executable(self):
|
144
177
|
"""Tries to locate the pip executable in the same environment."""
|
145
178
|
try:
|
146
|
-
|
147
|
-
|
148
|
-
|
179
|
+
# Use the potentially corrected python path to find pip's location
|
180
|
+
# Note: This assumes pip is relative to python.exe, not pythonservice.exe
|
181
|
+
base_python = self.get_base_python_executable()
|
182
|
+
python_path = pathlib.Path(base_python.strip('"')) # Use unquoted path
|
149
183
|
pip_path = python_path.parent / "Scripts" / "pip.exe"
|
150
|
-
self.log_info(f"get_pip_executable: Checking for pip at {pip_path}")
|
184
|
+
self.log_info(f"get_pip_executable: Checking for pip relative to {python_path.parent} at {pip_path}")
|
151
185
|
|
152
186
|
if pip_path.exists():
|
153
187
|
self.log_info(f"get_pip_executable: pip.exe found at {pip_path}")
|
@@ -156,14 +190,14 @@ class GuardService(win32serviceutil.ServiceFramework):
|
|
156
190
|
pip_exe = f'"{pip_exe}"'
|
157
191
|
return pip_exe
|
158
192
|
else:
|
159
|
-
self.log_error(f"get_pip_executable: pip.exe NOT found at {pip_path}. Falling back to '
|
193
|
+
self.log_error(f"get_pip_executable: pip.exe NOT found at {pip_path}. Falling back to '{base_python} -m pip'.")
|
160
194
|
pass
|
161
|
-
|
162
195
|
except Exception as e:
|
163
196
|
self.log_error(f"get_pip_executable: Error determining pip path: {e}", exc_info=True)
|
164
|
-
self.log_error("get_pip_executable: Falling back to 'python -m pip' due to error.")
|
197
|
+
self.log_error(f"get_pip_executable: Falling back to 'python -m pip' due to error.")
|
165
198
|
|
166
|
-
|
199
|
+
# Fallback uses the potentially corrected python path
|
200
|
+
return f"{self.get_base_python_executable()} -m pip"
|
167
201
|
|
168
202
|
# --- PowerShell Methods (Moved from module level) ---
|
169
203
|
def run_powershell_command(self, command, log_output=True):
|
@@ -250,11 +284,13 @@ class GuardService(win32serviceutil.ServiceFramework):
|
|
250
284
|
self.command_processor_thread = None
|
251
285
|
self.session = requests.Session()
|
252
286
|
|
253
|
-
# Initialize paths using instance methods
|
254
|
-
self.python_exe = self.
|
287
|
+
# Initialize paths using instance methods that prefer python.exe
|
288
|
+
self.python_exe = self.get_base_python_executable()
|
255
289
|
self.pip_command_base = self.get_pip_executable()
|
290
|
+
# Construct command using the potentially corrected python.exe path
|
256
291
|
self.ootb_command = f"{self.python_exe} -m {_OOTB_MODULE}"
|
257
292
|
_service_instance = self
|
293
|
+
self.log_info(f"Service initialized. OOTB command set to: {self.ootb_command}")
|
258
294
|
|
259
295
|
def SvcStop(self):
|
260
296
|
self.log_info(f"Service stop requested.")
|
@@ -413,10 +449,11 @@ class GuardService(win32serviceutil.ServiceFramework):
|
|
413
449
|
target_users.add(username.lower())
|
414
450
|
else:
|
415
451
|
target_users.add(target_user.lower())
|
416
|
-
|
417
452
|
self.log_info(f"Searching for OOTB processes for users: {target_users}")
|
418
|
-
|
419
|
-
|
453
|
+
|
454
|
+
# Use the potentially corrected python.exe path for matching
|
455
|
+
python_exe_path_for_check = self.python_exe.strip('"')
|
456
|
+
self.log_info(f"_get_ootb_processes: Checking against python path: {python_exe_path_for_check}")
|
420
457
|
|
421
458
|
for proc in psutil.process_iter(['pid', 'name', 'username', 'cmdline', 'exe']):
|
422
459
|
try:
|
@@ -427,12 +464,11 @@ class GuardService(win32serviceutil.ServiceFramework):
|
|
427
464
|
|
428
465
|
if proc_username in target_users:
|
429
466
|
cmdline = ' '.join(pinfo['cmdline']) if pinfo['cmdline'] else ''
|
430
|
-
# Check if the process executable matches our python path AND module is in cmdline
|
431
|
-
if pinfo['exe'] and pinfo['exe'] ==
|
467
|
+
# Check if the process executable matches our corrected python path AND module is in cmdline
|
468
|
+
if pinfo['exe'] and pinfo['exe'] == python_exe_path_for_check and _OOTB_MODULE in cmdline:
|
432
469
|
self.log_info(f"Found matching OOTB process: PID={pinfo['pid']}, User={pinfo['username']}, Cmd={cmdline}")
|
433
470
|
ootb_procs.append(proc)
|
434
471
|
target_pid_list.append(pinfo['pid'])
|
435
|
-
|
436
472
|
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
|
437
473
|
continue
|
438
474
|
self.log_info(f"Found {len(ootb_procs)} OOTB process(es) matching criteria: {target_pid_list}")
|
{computer_use_ootb_internal-0.0.121.dist-info → computer_use_ootb_internal-0.0.122.dist-info}/RECORD
RENAMED
@@ -3,7 +3,7 @@ computer_use_ootb_internal/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4Tv
|
|
3
3
|
computer_use_ootb_internal/app_teachmode.py,sha256=PClMS7X6zRGzY7YPOV6Zxkfv5BajLVqmBiv-mOBVxkw,22164
|
4
4
|
computer_use_ootb_internal/app_teachmode_gradio.py,sha256=cmFpBrkdlZxOQADWveVdIaaNqaBD8IVs-xNLJogU7F8,7909
|
5
5
|
computer_use_ootb_internal/dependency_check.py,sha256=y8RMEP6RXQzTgU1MS_1piBLtz4J-Hfn9RjUZg59dyvo,1333
|
6
|
-
computer_use_ootb_internal/guard_service.py,sha256=
|
6
|
+
computer_use_ootb_internal/guard_service.py,sha256=rxTdjzhcZf-Osohnf9xnKFTiKUr-DJAgFHPEGfmFDVI,42789
|
7
7
|
computer_use_ootb_internal/requirements-lite.txt,sha256=5DAHomz4A_P2BmTIXNkNqkHbnIF0AyZ4_1XAlb1LaYs,290
|
8
8
|
computer_use_ootb_internal/run_teachmode_ootb_args.py,sha256=7Dj0iY4GG7P03tRKYJ2x9Yvt-PE-b7uyjCAed3SaF3Y,7086
|
9
9
|
computer_use_ootb_internal/service_manager.py,sha256=SD8jzfn0VVXBOr_nP6zmBWSC2TzrU_sp2e5JJkSlQFU,9734
|
@@ -34,7 +34,7 @@ computer_use_ootb_internal/computer_use_demo/tools/run.py,sha256=xhXdnBK1di9muaO
|
|
34
34
|
computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py,sha256=L8qfvtUkPPQGt92N-2Zfw5ZTDBzLsDps39uMnX3_uSA,6857
|
35
35
|
computer_use_ootb_internal/preparation/__init__.py,sha256=AgtGHcBpiTkxJjF0xwcs3yyQ6SyUvhL3G0vD2XO-zJw,63
|
36
36
|
computer_use_ootb_internal/preparation/star_rail_prepare.py,sha256=s1VWszcTnJAKxqCHFlaOEwPkqVSrkiFx_yKpWSnSbHs,2649
|
37
|
-
computer_use_ootb_internal-0.0.
|
38
|
-
computer_use_ootb_internal-0.0.
|
39
|
-
computer_use_ootb_internal-0.0.
|
40
|
-
computer_use_ootb_internal-0.0.
|
37
|
+
computer_use_ootb_internal-0.0.122.dist-info/METADATA,sha256=l4cD__IPEj-hiKqiaFO49w016NHjVZ1y7cza5WHKDYc,1048
|
38
|
+
computer_use_ootb_internal-0.0.122.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
39
|
+
computer_use_ootb_internal-0.0.122.dist-info/entry_points.txt,sha256=bXfyAU_qq-G1EiEgAQEioXvgEdRCFxaTooqdDD9Y4OA,258
|
40
|
+
computer_use_ootb_internal-0.0.122.dist-info/RECORD,,
|
{computer_use_ootb_internal-0.0.121.dist-info → computer_use_ootb_internal-0.0.122.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|