Skip to content

Commit

Permalink
Add installation of .cmd wrappers for scripts on Windows
Browse files Browse the repository at this point in the history
Partially addresses #1 (other part needs to be investigated in pip)
  • Loading branch information
takluyver committed Mar 22, 2015
1 parent 2dc9da8 commit c419dd9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion flit/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,17 @@ def install_scripts(self, script_defs, scripts_dir):
))
script_file.chmod(0o755)

self.installed_files.append(str(script_file))
self.installed_files.append(script_file)

if sys.platform == 'win32':
cmd_file = script_file.with_suffix('.cmd')
cmd = '"{python}" "%~dp0\{script}" %*\r\n'.format(
python=sys.executable, script=name)
log.debug("Writing script wrapper to %s", cmd_file)
with cmd_file.open('w') as f:
f.write(cmd)

self.installed_files.append(cmd_file)

def _record_installed_directory(self, path):
for dirpath, dirnames, files in os.walk(path):
Expand Down

0 comments on commit c419dd9

Please sign in to comment.