Skip to content

Commit

Permalink
fix: support noxfile being a symlink
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Oct 18, 2024
1 parent 771c1c7 commit 4a5a190
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions nox/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ def load_nox_module(global_config: Namespace) -> types.ModuleType | int:
# Be sure to expand variables
global_config_noxfile = os.path.expandvars(global_config.noxfile)

# Make sure we only expand the parent dir just in case the noxfile is a symlink
noxfile_parent_dir = os.path.realpath(os.path.dirname(global_config_noxfile))

# Save the absolute path to the Noxfile.
# This will inoculate it if Nox changes paths because of an implicit
# or explicit chdir (like the one below).
global_config.noxfile = os.path.realpath(global_config_noxfile)

# Make sure we only expand the parent dir just in case the noxfile is a symlink
noxfile_parent_dir = os.path.realpath(os.path.dirname(global_config.noxfile))
global_config.noxfile = os.path.join(
noxfile_parent_dir, os.path.basename(global_config_noxfile)
)

try:
# Check ``nox.needs_version`` by parsing the AST.
Expand Down

0 comments on commit 4a5a190

Please sign in to comment.