Skip to content

Commit

Permalink
Merge pull request #200 from takluyver/cmd-installdir
Browse files Browse the repository at this point in the history
Fix locating installdir in command wrappers
  • Loading branch information
takluyver committed Jul 3, 2020
2 parents fa69cd3 + 7ba04fb commit 51fe9a7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nsist/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
SCRIPT_TEMPLATE = u"""# -*- coding: utf-8 -*-
import sys, os
import site
installdir = os.path.dirname(os.path.dirname(__file__))
installdir = os.path.dirname(os.path.dirname(sys.executable))
pkgdir = os.path.join(installdir, 'pkgs')
sys.path.insert(0, pkgdir)
# Ensure .pth files in pkgdir are handled properly
Expand Down
2 changes: 1 addition & 1 deletion nsist/tests/console_example/installer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ entry_point=sample_printer:main
console=true

[Python]
version=3.6.3
version=3.8.3
bitness=64
format=bundled

Expand Down
6 changes: 5 additions & 1 deletion nsist/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,19 @@ def test_installer(console_eg_copy, tmp_path):
res = run([str(inst_python), str(inst_launch_script)],
check=True, stdout=PIPE)
json_res = json.loads(res.stdout.decode('utf-8', 'replace'))
print(res.stdout.decode('utf-8', 'replace'))

assert json_res['py_executable'] == str(inst_python)
assert json_res['py_version'].startswith('3.6.3') # Set in installer.cfg
assert json_res['py_version'].startswith('3.8.3') # Set in installer.cfg
assert json_res['data_file_path'].endswith('data.txt')
assert json_res['data_file_content'] == 'newt'

# Run through command-line wrapper
res2 = run([str(inst_exe_wrapper)], check=True, stdout=PIPE)
print("Command line wrapper -----------------------------------------")
print(res2.stdout.decode('utf-8', 'replace'))
json_res2 = json.loads(res2.stdout.decode('utf-8', 'replace'))

assert json_res2 == json_res

# Check command-line wrapper is on PATH
Expand Down

0 comments on commit 51fe9a7

Please sign in to comment.