shotgun-sh 0.1.3__py3-none-any.whl → 0.1.4__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.
Potentially problematic release.
This version of shotgun-sh might be problematic. Click here for more details.
- shotgun/utils/update_checker.py +105 -2
- {shotgun_sh-0.1.3.dist-info → shotgun_sh-0.1.4.dist-info}/METADATA +1 -1
- {shotgun_sh-0.1.3.dist-info → shotgun_sh-0.1.4.dist-info}/RECORD +6 -6
- {shotgun_sh-0.1.3.dist-info → shotgun_sh-0.1.4.dist-info}/WHEEL +0 -0
- {shotgun_sh-0.1.3.dist-info → shotgun_sh-0.1.4.dist-info}/entry_points.txt +0 -0
- {shotgun_sh-0.1.3.dist-info → shotgun_sh-0.1.4.dist-info}/licenses/LICENSE +0 -0
shotgun/utils/update_checker.py
CHANGED
|
@@ -249,6 +249,9 @@ def perform_update(force: bool = False) -> tuple[bool, str]:
|
|
|
249
249
|
if not compare_versions(__version__, latest):
|
|
250
250
|
return False, f"Already at latest version ({__version__})"
|
|
251
251
|
|
|
252
|
+
# Store current version for comparison
|
|
253
|
+
current_version = __version__
|
|
254
|
+
|
|
252
255
|
# Detect installation method
|
|
253
256
|
method = detect_installation_method()
|
|
254
257
|
command = get_update_command(method)
|
|
@@ -260,8 +263,108 @@ def perform_update(force: bool = False) -> tuple[bool, str]:
|
|
|
260
263
|
|
|
261
264
|
result = subprocess.run(command, capture_output=True, text=True, timeout=60) # noqa: S603
|
|
262
265
|
|
|
263
|
-
|
|
264
|
-
|
|
266
|
+
# Log output for debugging
|
|
267
|
+
if result.stdout:
|
|
268
|
+
logger.debug(f"Update stdout: {result.stdout}")
|
|
269
|
+
if result.stderr:
|
|
270
|
+
logger.debug(f"Update stderr: {result.stderr}")
|
|
271
|
+
logger.debug(f"Update return code: {result.returncode}")
|
|
272
|
+
|
|
273
|
+
# Check for success patterns in output (pipx specific)
|
|
274
|
+
output_combined = (result.stdout or "") + (result.stderr or "")
|
|
275
|
+
|
|
276
|
+
# For pipx, check if it mentions successful upgrade or already at latest
|
|
277
|
+
pipx_success_patterns = [
|
|
278
|
+
"successfully upgraded",
|
|
279
|
+
"is already at latest version",
|
|
280
|
+
f"installed package shotgun-sh {latest}",
|
|
281
|
+
"upgrading shotgun-sh...",
|
|
282
|
+
]
|
|
283
|
+
|
|
284
|
+
pipx_success = method == "pipx" and any(
|
|
285
|
+
pattern.lower() in output_combined.lower()
|
|
286
|
+
for pattern in pipx_success_patterns
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
# Verify actual installation by checking version
|
|
290
|
+
update_successful = False
|
|
291
|
+
if result.returncode == 0 or pipx_success:
|
|
292
|
+
# Give the system a moment to update the package metadata
|
|
293
|
+
import time
|
|
294
|
+
|
|
295
|
+
time.sleep(1)
|
|
296
|
+
|
|
297
|
+
# Try to verify the installed version
|
|
298
|
+
try:
|
|
299
|
+
# For pipx, we need to check differently
|
|
300
|
+
if method == "pipx":
|
|
301
|
+
# Use pipx list to verify the installed version
|
|
302
|
+
verify_result = subprocess.run(
|
|
303
|
+
["pipx", "list", "--json"], # noqa: S607
|
|
304
|
+
capture_output=True,
|
|
305
|
+
text=True,
|
|
306
|
+
timeout=5, # noqa: S603
|
|
307
|
+
)
|
|
308
|
+
if verify_result.returncode == 0:
|
|
309
|
+
try:
|
|
310
|
+
pipx_data = json.loads(verify_result.stdout)
|
|
311
|
+
venvs = pipx_data.get("venvs", {})
|
|
312
|
+
shotgun_info = venvs.get("shotgun-sh", {})
|
|
313
|
+
metadata = shotgun_info.get("metadata", {})
|
|
314
|
+
main_package = metadata.get("main_package", {})
|
|
315
|
+
installed_version = main_package.get("package_version", "")
|
|
316
|
+
if installed_version == latest:
|
|
317
|
+
update_successful = True
|
|
318
|
+
logger.debug(
|
|
319
|
+
f"Pipx verification successful: version {installed_version}"
|
|
320
|
+
)
|
|
321
|
+
except (json.JSONDecodeError, KeyError) as e:
|
|
322
|
+
logger.debug(
|
|
323
|
+
f"Pipx JSON parsing failed: {e}, trusting patterns"
|
|
324
|
+
)
|
|
325
|
+
update_successful = pipx_success
|
|
326
|
+
else:
|
|
327
|
+
# Fallback to checking with command
|
|
328
|
+
import shutil
|
|
329
|
+
|
|
330
|
+
shotgun_path = shutil.which("shotgun")
|
|
331
|
+
if shotgun_path:
|
|
332
|
+
verify_result = subprocess.run( # noqa: S603
|
|
333
|
+
[shotgun_path, "--version"],
|
|
334
|
+
capture_output=True,
|
|
335
|
+
text=True,
|
|
336
|
+
timeout=5,
|
|
337
|
+
)
|
|
338
|
+
if (
|
|
339
|
+
verify_result.returncode == 0
|
|
340
|
+
and latest in verify_result.stdout
|
|
341
|
+
):
|
|
342
|
+
update_successful = True
|
|
343
|
+
logger.debug(
|
|
344
|
+
f"Version verification successful: {verify_result.stdout.strip()}"
|
|
345
|
+
)
|
|
346
|
+
else:
|
|
347
|
+
update_successful = pipx_success
|
|
348
|
+
else:
|
|
349
|
+
# For pip/venv, check with python module
|
|
350
|
+
verify_result = subprocess.run( # noqa: S603
|
|
351
|
+
[sys.executable, "-m", "shotgun", "--version"],
|
|
352
|
+
capture_output=True,
|
|
353
|
+
text=True,
|
|
354
|
+
timeout=5,
|
|
355
|
+
)
|
|
356
|
+
if verify_result.returncode == 0 and latest in verify_result.stdout:
|
|
357
|
+
update_successful = True
|
|
358
|
+
logger.debug(
|
|
359
|
+
f"Version verification successful: {verify_result.stdout.strip()}"
|
|
360
|
+
)
|
|
361
|
+
except Exception as e:
|
|
362
|
+
logger.debug(f"Version verification failed: {e}")
|
|
363
|
+
# If verification fails, trust the return code or pipx patterns
|
|
364
|
+
update_successful = result.returncode == 0 or pipx_success
|
|
365
|
+
|
|
366
|
+
if update_successful:
|
|
367
|
+
message = f"Successfully updated from {current_version} to {latest}"
|
|
265
368
|
logger.info(message)
|
|
266
369
|
|
|
267
370
|
# Clear cache to trigger fresh check next time
|
|
@@ -122,9 +122,9 @@ shotgun/tui/utils/mode_progress.py,sha256=lseRRo7kMWLkBzI3cU5vqJmS2ZcCjyRYf9Zwtv
|
|
|
122
122
|
shotgun/utils/__init__.py,sha256=WinIEp9oL2iMrWaDkXz2QX4nYVPAm8C9aBSKTeEwLtE,198
|
|
123
123
|
shotgun/utils/env_utils.py,sha256=8QK5aw_f_V2AVTleQQlcL0RnD4sPJWXlDG46fsHu0d8,1057
|
|
124
124
|
shotgun/utils/file_system_utils.py,sha256=l-0p1bEHF34OU19MahnRFdClHufThfGAjQ431teAIp0,1004
|
|
125
|
-
shotgun/utils/update_checker.py,sha256=
|
|
126
|
-
shotgun_sh-0.1.
|
|
127
|
-
shotgun_sh-0.1.
|
|
128
|
-
shotgun_sh-0.1.
|
|
129
|
-
shotgun_sh-0.1.
|
|
130
|
-
shotgun_sh-0.1.
|
|
125
|
+
shotgun/utils/update_checker.py,sha256=LPRzHyhjxxB8KE_EWVu9k2GobhB7DMh8EipbKT9NxVQ,23310
|
|
126
|
+
shotgun_sh-0.1.4.dist-info/METADATA,sha256=7ty9nX-YRs54NAKEmv8eGnnb8sri6cifCs9q75TQgeQ,11191
|
|
127
|
+
shotgun_sh-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
128
|
+
shotgun_sh-0.1.4.dist-info/entry_points.txt,sha256=asZxLU4QILneq0MWW10saVCZc4VWhZfb0wFZvERnzfA,45
|
|
129
|
+
shotgun_sh-0.1.4.dist-info/licenses/LICENSE,sha256=YebsZl590zCHrF_acCU5pmNt0pnAfD2DmAnevJPB1tY,1065
|
|
130
|
+
shotgun_sh-0.1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|