dist: fix the relative path of the files and output dirs in the generated NSIS script

Closes #1008
Fixes #1003
This commit is contained in:
LD 2020-09-01 21:19:56 +02:00 committed by rdb
parent c7f75fc906
commit 2e862c1bbe

View File

@ -1408,17 +1408,22 @@ class bdist_apps(setuptools.Command):
nsi.write('Section "" SecCore\n')
nsi.write(' SetOutPath "$INSTDIR"\n')
curdir = ""
nsi_dir = p3d.Filename.fromOsSpecific(build_cmd.build_base)
build_root_dir = p3d.Filename.fromOsSpecific(build_dir)
for root, dirs, files in os.walk(build_dir):
for name in files:
basefile = p3d.Filename.fromOsSpecific(os.path.join(root, name))
file = p3d.Filename(basefile)
file.makeAbsolute()
file.makeRelativeTo(build_dir)
outdir = file.getDirname().replace('/', '\\')
file.makeRelativeTo(nsi_dir)
outdir = p3d.Filename(basefile)
outdir.makeAbsolute()
outdir.makeRelativeTo(build_root_dir)
outdir = outdir.getDirname().replace('/', '\\')
if curdir != outdir:
nsi.write(' SetOutPath "$INSTDIR\\%s"\n' % outdir)
curdir = outdir
nsi.write(' File "%s"\n' % (basefile.toOsSpecific()))
nsi.write(' File "%s"\n' % (file.toOsSpecific()))
nsi.write(' SetOutPath "$INSTDIR"\n')
nsi.write(' WriteUninstaller "$INSTDIR\\Uninstall.exe"\n')
nsi.write(' ; Start menu items\n')