Commit edf74c4a authored by Hanno Schlichting's avatar Hanno Schlichting

Merge pull request #11 from agroszer/master

fixed dev.py on windows
parents 637c7a05 c14c9783
...@@ -1059,19 +1059,20 @@ def _distutils_script(path, dest, script_content, initialization, rsetup): ...@@ -1059,19 +1059,20 @@ def _distutils_script(path, dest, script_content, initialization, rsetup):
def _create_script(contents, dest): def _create_script(contents, dest):
generated = [] generated = []
script = dest script = dest
if is_win32:
dest += '-script.py'
changed = not (os.path.exists(dest) and open(dest).read() == contents) changed = not (os.path.exists(dest) and open(dest).read() == contents)
if is_win32: if is_win32:
# generate exe file and give the script a magic name: # generate exe file and give the script a magic name:
exe = script+'.exe' win32_exe = os.path.splitext(dest)[0] # remove ".py"
new_data = pkg_resources.resource_string('distribute', 'cli.exe') if win32_exe.endswith('-script'):
if not os.path.exists(exe) or (open(exe, 'rb').read() != new_data): win32_exe = win32_exe[:-7] # remove "-script"
win32_exe = win32_exe + '.exe' # add ".exe"
new_data = pkg_resources.resource_string('setuptools', 'cli.exe')
if not os.path.exists(win32_exe) or (open(win32_exe, 'rb').read() != new_data):
# Only write it if it's different. # Only write it if it's different.
open(exe, 'wb').write(new_data) open(win32_exe, 'wb').write(new_data)
generated.append(exe) generated.append(win32_exe)
if changed: if changed:
open(dest, 'w').write(contents) open(dest, 'w').write(contents)
...@@ -1139,7 +1140,7 @@ def _pyscript(path, dest, rsetup): ...@@ -1139,7 +1140,7 @@ def _pyscript(path, dest, rsetup):
# generate exe file and give the script a magic name: # generate exe file and give the script a magic name:
exe = script + '.exe' exe = script + '.exe'
open(exe, 'wb').write( open(exe, 'wb').write(
pkg_resources.resource_string('distribute', 'cli.exe') pkg_resources.resource_string('setuptools', 'cli.exe')
) )
generated.append(exe) generated.append(exe)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment