pyhabitat 1.0.29__py3-none-any.whl → 1.0.30__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 pyhabitat might be problematic. Click here for more details.
- pyhabitat/__init__.py +4 -0
- pyhabitat/environment.py +24 -7
- pyhabitat/report.py +0 -0
- {pyhabitat-1.0.29.dist-info → pyhabitat-1.0.30.dist-info}/METADATA +1 -1
- pyhabitat-1.0.30.dist-info/RECORD +16 -0
- pyhabitat-build/pyhabitat/cli.py +1 -1
- pyhabitat-build/pyhabitat/environment.py +8 -5
- pyhabitat-1.0.29.dist-info/RECORD +0 -15
- {pyhabitat-1.0.29.dist-info → pyhabitat-1.0.30.dist-info}/WHEEL +0 -0
- {pyhabitat-1.0.29.dist-info → pyhabitat-1.0.30.dist-info}/entry_points.txt +0 -0
- {pyhabitat-1.0.29.dist-info → pyhabitat-1.0.30.dist-info}/licenses/LICENSE +0 -0
- {pyhabitat-1.0.29.dist-info → pyhabitat-1.0.30.dist-info}/top_level.txt +0 -0
pyhabitat/__init__.py
CHANGED
|
@@ -30,6 +30,8 @@ from .environment import (
|
|
|
30
30
|
user_darrin_deyoung,
|
|
31
31
|
can_read_input,
|
|
32
32
|
can_spawn_shell,
|
|
33
|
+
is_ascii,
|
|
34
|
+
is_binary,
|
|
33
35
|
)
|
|
34
36
|
|
|
35
37
|
# Optional: Set __all__ for explicit documentation and cleaner imports
|
|
@@ -63,6 +65,8 @@ __all__ = [
|
|
|
63
65
|
'user_darrin_deyoung',
|
|
64
66
|
'can_read_input',
|
|
65
67
|
'can_spawn_shell',
|
|
68
|
+
'is_ascii',
|
|
69
|
+
'is_binary',
|
|
66
70
|
]
|
|
67
71
|
|
|
68
72
|
__version__ = get_version()
|
pyhabitat/environment.py
CHANGED
|
@@ -512,6 +512,19 @@ def is_python_script(path: Path | str | None = None, debug: bool = False, suppre
|
|
|
512
512
|
return False
|
|
513
513
|
return exec_path.suffix.lower() == '.py'
|
|
514
514
|
|
|
515
|
+
# --- File encoding check ---
|
|
516
|
+
def is_binary(path:str|Path|None=None)->bool:
|
|
517
|
+
"""
|
|
518
|
+
Target file is encoded as binary.
|
|
519
|
+
"""
|
|
520
|
+
pass
|
|
521
|
+
|
|
522
|
+
def is_ascii(path:str|Path|None=None)->bool:
|
|
523
|
+
"""
|
|
524
|
+
Target file is encoded as ascii, plaintext.
|
|
525
|
+
"""
|
|
526
|
+
pass
|
|
527
|
+
|
|
515
528
|
# --- Interpreter Check ---
|
|
516
529
|
|
|
517
530
|
def interp_path(debug: bool = False) -> str:
|
|
@@ -545,14 +558,14 @@ def interactive_terminal_is_available():
|
|
|
545
558
|
|
|
546
559
|
"""
|
|
547
560
|
# Address walmart demo unit edge case, fast check, though this might hamstring othwrwise successful processes
|
|
548
|
-
if
|
|
561
|
+
if user_darrin_deyoung():
|
|
549
562
|
return False
|
|
550
|
-
#
|
|
563
|
+
# Check of a new shell can be launched to print stuff
|
|
551
564
|
if not can_spawn_shell():
|
|
552
565
|
return False
|
|
553
566
|
# A user can interact with a console, providing input
|
|
554
|
-
if not can_read_input():
|
|
555
|
-
|
|
567
|
+
#if not can_read_input():
|
|
568
|
+
# return False
|
|
556
569
|
# Check if a tty is attached to stdin
|
|
557
570
|
return sys.stdin.isatty() and sys.stdout.isatty()
|
|
558
571
|
|
|
@@ -572,12 +585,14 @@ def can_spawn_shell(override_known:bool=False)->bool:
|
|
|
572
585
|
result = subprocess.run( ['echo', 'hello'],
|
|
573
586
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
|
574
587
|
timeout=2 )
|
|
588
|
+
|
|
575
589
|
_CAN_SPAWN_SHELL = True
|
|
590
|
+
|
|
576
591
|
return result.returncode == 0
|
|
577
592
|
except subprocess.TimeoutExpired:
|
|
578
593
|
logging.debug("Shell spawn failed: TimeoutExpired")
|
|
579
|
-
_CAN_SPAWN_SHELL =
|
|
580
|
-
return
|
|
594
|
+
_CAN_SPAWN_SHELL = result.returncode == 0
|
|
595
|
+
return _CAN_SPAWN_SHELL
|
|
581
596
|
except subprocess.SubprocessError:
|
|
582
597
|
logging.debug("Shell spawn failed: SubprocessError")
|
|
583
598
|
_CAN_SPAWN_SHELL = False
|
|
@@ -593,6 +608,7 @@ def can_read_input(override_known:bool=False)-> bool:
|
|
|
593
608
|
if _CAN_READ_INPUT is not None and override_known is False:
|
|
594
609
|
return _CAN_READ_INPUT
|
|
595
610
|
try:
|
|
611
|
+
# ERROR THIS IS NOT A BOOLEAN, IS RETURNS []
|
|
596
612
|
_CAN_READ_INPUT = select.select([sys.stdin], [], [], 0.1)[0]
|
|
597
613
|
return _CAN_READ_INPUT
|
|
598
614
|
except ValueError:
|
|
@@ -620,6 +636,7 @@ def web_browser_is_available() -> bool:
|
|
|
620
636
|
if shutil.which("xdg-open"):
|
|
621
637
|
return True
|
|
622
638
|
return False
|
|
639
|
+
|
|
623
640
|
|
|
624
641
|
# --- LAUNCH MECHANISMS BASED ON ENVIRONMENT ---
|
|
625
642
|
def edit_textfile(path: Path | str | None = None) -> None:
|
|
@@ -899,7 +916,7 @@ def main(path=None, debug=False):
|
|
|
899
916
|
# Keep window open. This iteration is non rigorous.
|
|
900
917
|
# To address use pf Python launcher from Windows Store to launch downoaded .pyz, which closed quickly
|
|
901
918
|
try:
|
|
902
|
-
input("Press Return to
|
|
919
|
+
input("Press Return to Continue...")
|
|
903
920
|
except Exception as e:
|
|
904
921
|
logging.debug("input() failed")
|
|
905
922
|
|
pyhabitat/report.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
pyhabitat/__init__.py,sha256=7XNuHIDBXvjn_EORWZZUNsBS3qpvWRUha1NHwC3d6bw,1539
|
|
2
|
+
pyhabitat/cli.py,sha256=L7VA-OOust2g6_MxedvvOr4RdnS_-5ZGP2Aj4VtdqAg,2221
|
|
3
|
+
pyhabitat/environment.py,sha256=Us6AXG3T3ocSa8giPvg_zSPVneIQsxa6FjBgcBINmOg,36980
|
|
4
|
+
pyhabitat/report.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
pyhabitat/utils.py,sha256=2IGLKGAvDFGQgIzlId4ZGGTJRGG0MXR9UVH3nlQKmHg,988
|
|
6
|
+
pyhabitat-1.0.30.dist-info/licenses/LICENSE,sha256=D4fg30ctUGnCJlWu3ONv5-V8JE1v3ctakoJTcVjsJlg,1072
|
|
7
|
+
pyhabitat-build/__main__.py,sha256=6wcF1BhvoRQe4iwq1Px0GNughRXGFRBufWRdaZePu1s,99
|
|
8
|
+
pyhabitat-build/pyhabitat/__init__.py,sha256=UIlLMIMnJHwV1UHAqNgvC_HURGtCUUgp-34-329FV6E,1477
|
|
9
|
+
pyhabitat-build/pyhabitat/cli.py,sha256=L7VA-OOust2g6_MxedvvOr4RdnS_-5ZGP2Aj4VtdqAg,2221
|
|
10
|
+
pyhabitat-build/pyhabitat/environment.py,sha256=4CL7y1KRoYvaHU9uR5jToOmvo_l9OUQPSHdW-i-WXRM,36721
|
|
11
|
+
pyhabitat-build/pyhabitat/utils.py,sha256=2IGLKGAvDFGQgIzlId4ZGGTJRGG0MXR9UVH3nlQKmHg,988
|
|
12
|
+
pyhabitat-1.0.30.dist-info/METADATA,sha256=8C1M_s19eT8bPsQr6jt7KOXkebKpntZzmKwHlwZydcI,10900
|
|
13
|
+
pyhabitat-1.0.30.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
pyhabitat-1.0.30.dist-info/entry_points.txt,sha256=409xZ-BrarQJJLtO-aActCGkL0FMhNVi9wsq3u7tRHM,52
|
|
15
|
+
pyhabitat-1.0.30.dist-info/top_level.txt,sha256=zI4aHwfZxhq45fnyLM34qDaerg2Iyb4mcsOP-itrJPY,26
|
|
16
|
+
pyhabitat-1.0.30.dist-info/RECORD,,
|
pyhabitat-build/pyhabitat/cli.py
CHANGED
|
@@ -551,8 +551,8 @@ def interactive_terminal_is_available():
|
|
|
551
551
|
if not can_spawn_shell():
|
|
552
552
|
return False
|
|
553
553
|
# A user can interact with a console, providing input
|
|
554
|
-
if not can_read_input():
|
|
555
|
-
|
|
554
|
+
#if not can_read_input():
|
|
555
|
+
# return False
|
|
556
556
|
# Check if a tty is attached to stdin
|
|
557
557
|
return sys.stdin.isatty() and sys.stdout.isatty()
|
|
558
558
|
|
|
@@ -572,12 +572,14 @@ def can_spawn_shell(override_known:bool=False)->bool:
|
|
|
572
572
|
result = subprocess.run( ['echo', 'hello'],
|
|
573
573
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
|
574
574
|
timeout=2 )
|
|
575
|
+
|
|
575
576
|
_CAN_SPAWN_SHELL = True
|
|
577
|
+
|
|
576
578
|
return result.returncode == 0
|
|
577
579
|
except subprocess.TimeoutExpired:
|
|
578
580
|
logging.debug("Shell spawn failed: TimeoutExpired")
|
|
579
|
-
_CAN_SPAWN_SHELL =
|
|
580
|
-
return
|
|
581
|
+
_CAN_SPAWN_SHELL = result.returncode == 0
|
|
582
|
+
return _CAN_SPAWN_SHELL
|
|
581
583
|
except subprocess.SubprocessError:
|
|
582
584
|
logging.debug("Shell spawn failed: SubprocessError")
|
|
583
585
|
_CAN_SPAWN_SHELL = False
|
|
@@ -593,6 +595,7 @@ def can_read_input(override_known:bool=False)-> bool:
|
|
|
593
595
|
if _CAN_READ_INPUT is not None and override_known is False:
|
|
594
596
|
return _CAN_READ_INPUT
|
|
595
597
|
try:
|
|
598
|
+
# ERROR THIS IS NOT A BOOLEAN, IS RETURNS []
|
|
596
599
|
_CAN_READ_INPUT = select.select([sys.stdin], [], [], 0.1)[0]
|
|
597
600
|
return _CAN_READ_INPUT
|
|
598
601
|
except ValueError:
|
|
@@ -899,7 +902,7 @@ def main(path=None, debug=False):
|
|
|
899
902
|
# Keep window open. This iteration is non rigorous.
|
|
900
903
|
# To address use pf Python launcher from Windows Store to launch downoaded .pyz, which closed quickly
|
|
901
904
|
try:
|
|
902
|
-
input("Press Return to
|
|
905
|
+
input("Press Return to Continue...")
|
|
903
906
|
except Exception as e:
|
|
904
907
|
logging.debug("input() failed")
|
|
905
908
|
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
pyhabitat/__init__.py,sha256=UIlLMIMnJHwV1UHAqNgvC_HURGtCUUgp-34-329FV6E,1477
|
|
2
|
-
pyhabitat/cli.py,sha256=L7VA-OOust2g6_MxedvvOr4RdnS_-5ZGP2Aj4VtdqAg,2221
|
|
3
|
-
pyhabitat/environment.py,sha256=V489_X3uX7GcszEBNo16dG2kxOP9gA86cJwG99r-D20,36616
|
|
4
|
-
pyhabitat/utils.py,sha256=2IGLKGAvDFGQgIzlId4ZGGTJRGG0MXR9UVH3nlQKmHg,988
|
|
5
|
-
pyhabitat-1.0.29.dist-info/licenses/LICENSE,sha256=D4fg30ctUGnCJlWu3ONv5-V8JE1v3ctakoJTcVjsJlg,1072
|
|
6
|
-
pyhabitat-build/__main__.py,sha256=6wcF1BhvoRQe4iwq1Px0GNughRXGFRBufWRdaZePu1s,99
|
|
7
|
-
pyhabitat-build/pyhabitat/__init__.py,sha256=UIlLMIMnJHwV1UHAqNgvC_HURGtCUUgp-34-329FV6E,1477
|
|
8
|
-
pyhabitat-build/pyhabitat/cli.py,sha256=wWGd7dwFhFjWV76WEysJ3AR4yRdrfCBM5vjPiON31bM,2220
|
|
9
|
-
pyhabitat-build/pyhabitat/environment.py,sha256=V489_X3uX7GcszEBNo16dG2kxOP9gA86cJwG99r-D20,36616
|
|
10
|
-
pyhabitat-build/pyhabitat/utils.py,sha256=2IGLKGAvDFGQgIzlId4ZGGTJRGG0MXR9UVH3nlQKmHg,988
|
|
11
|
-
pyhabitat-1.0.29.dist-info/METADATA,sha256=t9bNdd0vKy-sAOU1mnMpUgKbU1HRWBvsp7xy2uloZ7Y,10900
|
|
12
|
-
pyhabitat-1.0.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
-
pyhabitat-1.0.29.dist-info/entry_points.txt,sha256=409xZ-BrarQJJLtO-aActCGkL0FMhNVi9wsq3u7tRHM,52
|
|
14
|
-
pyhabitat-1.0.29.dist-info/top_level.txt,sha256=zI4aHwfZxhq45fnyLM34qDaerg2Iyb4mcsOP-itrJPY,26
|
|
15
|
-
pyhabitat-1.0.29.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|