pyhabitat 1.0.19__py3-none-any.whl → 1.0.20__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/environment.py CHANGED
@@ -226,18 +226,21 @@ def on_wsl():
226
226
  if "WSL_DISTRO_NAME" in os.environ or "WSL_INTEROP" in os.environ:
227
227
  return True
228
228
 
229
- # --- Check kernel info for 'microsoft' string ---
229
+ # --- Check kernel info for 'microsoft' or 'wsl' string (Fallback) ---
230
230
  # False negative risk:
231
231
  # Custom kernels, future Windows versions, or minimal WSL distros may omit 'microsoft' in strings.
232
232
  # False negative likelihood: Very low to moderate.
233
-
234
233
  try:
235
234
  with open("/proc/version") as f:
235
+ version_info = f.read().lower()
236
236
  if "microsoft" in version_info or "wsl" in version_info:
237
237
  return True
238
- except FileNotFoundError:
238
+ except (IOError, OSError):
239
+ # This block would catch the PermissionError!
240
+ # It would simply 'pass' and move on.
239
241
  pass
240
-
242
+
243
+
241
244
  # Check for WSL-specific mounts (fallback)
242
245
  """
243
246
  /proc/sys/kernel/osrelease
@@ -245,17 +248,17 @@ def on_wsl():
245
248
  Very reliable for detecting WSL1 and WSL2 unless someone compiled a custom kernel and removed the microsoft string.
246
249
 
247
250
  False negative risk:
248
- If /proc/version or /proc/sys/kernel/osrelease cannot be read due to permissions, a containerized WSL distro, or some sandboxed environment.
251
+ If /proc/sys/kernel/osrelease cannot be read due to permissions, a containerized WSL distro, or some sandboxed environment.
249
252
  # False negative likelihood: Very low.
250
253
  """
251
- if Path("/proc/sys/kernel/osrelease").exists():
252
- try:
253
- with open("/proc/sys/kernel/osrelease") as f:
254
- osrelease = f.read().lower()
255
- if "microsoft" in osrelease:
256
- return True
257
- except Exception:
258
- pass
254
+ try:
255
+ with open("/proc/sys/kernel/osrelease") as f:
256
+ osrelease = f.read().lower()
257
+ if "microsoft" in osrelease:
258
+ return True
259
+ except (IOError, OSError):
260
+ # This block would catch the PermissionError, an FileNotFound
261
+ pass
259
262
  return False
260
263
 
261
264
  def on_pydroid():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyhabitat
3
- Version: 1.0.19
3
+ Version: 1.0.20
4
4
  Summary: A lightweight library for detecting system environment, GUI, and build properties.
5
5
  Author-email: George Clayton Bennett <george.bennett@memphistn.gov>
6
6
  License-Expression: MIT
@@ -0,0 +1,11 @@
1
+ pyhabitat/__init__.py,sha256=B_yS2yBG2kjHkte_xissSG8aJ15af-soBo3Cy7caiEc,1288
2
+ pyhabitat/__main__.py,sha256=qlOKShd_Xk0HGpYOySXQSQe3K60a9wwrstCAceJkKIs,76
3
+ pyhabitat/__main__stable.py,sha256=UACpHLrr_Rmf0L5dJCEae6kFzLn7dqCqIri68IBnb10,2910
4
+ pyhabitat/cli.py,sha256=ZlY6v_IT7Mw-ekR3WPT8NLsqMQ_RXI-cckVq9oLT4AU,683
5
+ pyhabitat/environment.py,sha256=YlrcmovQBa7JapQLCqG9R6pjmYElL-8oVUHVSXH4MLw,33007
6
+ pyhabitat-1.0.20.dist-info/licenses/LICENSE,sha256=D4fg30ctUGnCJlWu3ONv5-V8JE1v3ctakoJTcVjsJlg,1072
7
+ pyhabitat-1.0.20.dist-info/METADATA,sha256=1MXhoZ1tOLB_tm1JHkH21-vubm3QWtlSW4os7GTB_WE,10900
8
+ pyhabitat-1.0.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ pyhabitat-1.0.20.dist-info/entry_points.txt,sha256=409xZ-BrarQJJLtO-aActCGkL0FMhNVi9wsq3u7tRHM,52
10
+ pyhabitat-1.0.20.dist-info/top_level.txt,sha256=zXYK44Qu8EqxUETREvd2diMUaB5JiGRErkwFaoLQnnI,10
11
+ pyhabitat-1.0.20.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- pyhabitat/__init__.py,sha256=B_yS2yBG2kjHkte_xissSG8aJ15af-soBo3Cy7caiEc,1288
2
- pyhabitat/__main__.py,sha256=qlOKShd_Xk0HGpYOySXQSQe3K60a9wwrstCAceJkKIs,76
3
- pyhabitat/__main__stable.py,sha256=UACpHLrr_Rmf0L5dJCEae6kFzLn7dqCqIri68IBnb10,2910
4
- pyhabitat/cli.py,sha256=ZlY6v_IT7Mw-ekR3WPT8NLsqMQ_RXI-cckVq9oLT4AU,683
5
- pyhabitat/environment.py,sha256=2wyjdWNRSv8VxaXkjoQz285ATAlhddrY_dor45mMnQ4,32871
6
- pyhabitat-1.0.19.dist-info/licenses/LICENSE,sha256=D4fg30ctUGnCJlWu3ONv5-V8JE1v3ctakoJTcVjsJlg,1072
7
- pyhabitat-1.0.19.dist-info/METADATA,sha256=N8o0nM2KOq7X4B-JNUMcePtqjinqsdqrqZ11Ct8qsRY,10900
8
- pyhabitat-1.0.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
- pyhabitat-1.0.19.dist-info/entry_points.txt,sha256=409xZ-BrarQJJLtO-aActCGkL0FMhNVi9wsq3u7tRHM,52
10
- pyhabitat-1.0.19.dist-info/top_level.txt,sha256=zXYK44Qu8EqxUETREvd2diMUaB5JiGRErkwFaoLQnnI,10
11
- pyhabitat-1.0.19.dist-info/RECORD,,