Skip to content

fix(release): read the environment without os.environb where Windows lacks it (#2120) - #2122

Merged
JarryShaw merged 1 commit into
mainfrom
fix/2120-environb-windows
Oct 24, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/2120-environb-windows

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • fix — bug fixes

Description of your pull request and other information

Closes #2120. release_published.var() and release_tiers.var() read os.environb, which does not exist where os.supports_bytes_environ is false, as on Windows. Every conda-dist (windows-latest) leg of Conda Update run 40020510868 therefore died at the first line of release_conda.py build, before conda build ran.

  • Fix: a new shared util/_actions.getenvb(name) reads os.environb where it exists and os.fsencode(os.environ[name]) otherwise. Both var()s call it inside their existing except KeyError, so an unset variable still gives <name>: unbound variable and exits 1.
  • Rest of the Windows build path: no other POSIX-only stdlib use was found in release_conda.py, release_published.py, _actions.py, leg_summary.py or conda_vendor.py. Not verified: that subprocess finds conda.exe on PATH under bash -el; the next run will show it.
  • Test: TestTheEnvironmentWithoutEnvironb in test_conda_windows_leg_2060 removes os.environb and sets supports_bytes_environ = False. It checks the helper and both var()s, that release_conda.main(['build']) gets past the env reads to the conda build call, and that an unset variable still fails the same way. With the fix reverted, 6 checks fail with the CI's AttributeError. The conda, release-script, helper and release-gates tests pass.

@JarryShaw JarryShaw added bug Issues reporting a defect (set by the bug report template; a default, not an assessment) ci Pull requests that change CI or workflow configuration (ci: subject prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 23, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at f4f24e3b6 (Sonnet review).

  • POSIX unchanged: for b'caf\xe9\xff', getenvb returns the same bytes as os.fsencode(os.environ[…]), and an unset name still becomes Unbound.
  • util/ clean: it is stdlib-only, in __all__, and has no other os.environb use left. The rest of the build path is portable.
  • Tests: they fail with util/ reverted (6 failed). The Windows-leg, release-conda, version-check and helper tests pass.
  • UNVERIFIED (reasoning only): that call('conda', …) finds conda.exe on PATH under bash -el. The first win-64 run after this merges will show it.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 23, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 23, 2026
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Coverage: 91.54% (unit tier, Python 3.15, 8777e5e5a, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19599 880 2618 866 92.12%
pcapkit/corekit 2589 75 816 37 96.48%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 2959 23 1032 25 98.80%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17418 219 4574 185 98.14%
pcapkit/toolkit 869 36 298 10 95.20%
pcapkit/utilities 498 7 144 5 98.13%
pcapkit/vendor 4432 1988 1018 167 51.87%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge at f4f24e3b6.

This closes #2120. It conflicts with #2127 in one docstring of tests/project/test_conda_windows_leg_2060.py. I'll rebase whichever lands second.

@JarryShaw

Copy link
Copy Markdown
Owner Author

use :pr:/:issue: for the GitHub issue/PR link rendering.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Will do. The workflows.rst row for util/_actions.py becomes :issue:`2047` and :issue:`2120` , in place of the hand-written links. A fresh review follows the push. The rest of the repo's hand-written links go to #1103's next round.

@JarryShaw JarryShaw added review: needs-changes Cross-review at the current head says changes are required; see the verdict comment and removed review: good-to-go Cross-review at the current head says ready; CI state is separate labels Oct 24, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

use directives in Sphinx docs only. use #NNN format in plain comments and texts so that GitHub can auto render them.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Noted. The roles go only where Sphinx renders: .rst files, and the docstrings and #: comments that autodoc renders. Plain comments, util//tests/ docstrings, commit messages and GitHub text keep #NNN. This PR's other mentions of #2120 are all in util/ and tests/, so they stay as they are. #1103's reminder already scopes the sweep the same way.

@JarryShaw
JarryShaw force-pushed the fix/2120-environb-windows branch from f4f24e3 to 3ce5b48 Compare October 24, 2026 00:35
@JarryShaw JarryShaw added review: running A cross-review is in flight against the current head - no verdict yet and removed review: needs-changes Cross-review at the current head says changes are required; see the verdict comment labels Oct 24, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 3ce5b480e (Sonnet delta review).

  • Rebase: onto main 7904f615b. The range-diff against f4f24e3b6 shows only the workflows.rst row for util/_actions.py, which now reads :issue:`2047` and :issue:`2120` .
  • Docs: the issue extlink is defined in conf.py, and the list-table cell's reST is valid.
  • Scope: the PR's other #2120 mentions are in util/ and tests/, which Sphinx does not render, so they keep #NNN.
  • Tests: tests/project/test_conda_windows_leg_2060.py gives 26 passed.

I'll post the ready note when CI finishes on the new head.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 24, 2026
…lacks it (#2120)

util/release_published.py and util/release_tiers.py read each variable from os.environb, which exists only where os.supports_bytes_environ holds, so release_conda.py build died on the win-64 conda leg at its first variable. Both now read through a new util/_actions.py getenvb, which falls back to os.fsencode(os.environ[name]); an unset variable is still Unbound.

Tested on an emulated Windows os module in tests/project/test_conda_windows_leg_2060.py.
@JarryShaw
JarryShaw force-pushed the fix/2120-environb-windows branch from 3ce5b48 to 8777e5e Compare October 24, 2026 00:40
@JarryShaw

Copy link
Copy Markdown
Owner Author

Rebased 3ce5b480e → 8777e5e5a onto main 23a815b84, after #2127 landed.

  • The conflict: both PRs extended the module docstring of tests/project/test_conda_windows_leg_2060.py. The resolution keeps both: fix(conda): read conda-forge's CFEP-27 Windows layout in the smoke check (#2126) #2127's CFEP-27 sentence and this PR's TestTheEnvironmentWithoutEnvironb bullet.
  • Everything else is unchanged: the per-file patch-ids of workflows.rst, util/_actions.py, util/release_published.py and util/release_tiers.py are identical to the old head's. The test file differs only in that docstring context, and gives 28 passed.
  • Old head's CI: it had not finished, with 40 checks still queued or running, so CI has to run on the new head before this is ready.

@JarryShaw JarryShaw added review: running A cross-review is in flight against the current head - no verdict yet and removed review: good-to-go Cross-review at the current head says ready; CI state is separate labels Oct 24, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 8777e5e5a (Sonnet rebase check). The range-diff against 3ce5b480e differs only in the docstring resolution, which keeps both sides. The diff touches only this PR's five files, and tests/project/test_conda_windows_leg_2060.py gives 28 passed.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 24, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge at 8777e5e5a.

  • Review: GOOD TO GO, from the Sonnet delta review of the :issue: change and the Sonnet rebase check.
  • CI: every blocking check passed (Required checks passed SUCCESS). The 3.8–3.10 KTLO legs carry no warnings.
  • Ordering: the tests/project leg passed (2186 tests, 0 failures) at f4f24e3b6. Since then the per-file patch-ids of workflows.rst and the util/ files are identical, and the test file differs only in the docstring resolution. The head sits directly on main 23a815b84.

This closes #2120. Once it lands, #2060 phase 2 needs one Conda Update run on main with clean Windows legs.

@JarryShaw
JarryShaw merged commit 8fdc2fb into main Oct 24, 2026
63 checks passed
@JarryShaw
JarryShaw deleted the fix/2120-environb-windows branch October 24, 2026 01:57
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 24, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 24, 2026
@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issues reporting a defect (set by the bug report template; a default, not an assessment) ci Pull requests that change CI or workflow configuration (ci: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(release): util/release_published.var() reads os.environb, which Windows lacks, so every win-64 conda build fails

1 participant