| 1 |
#!/usr/bin/env python |
| 2 |
# |
| 3 |
# Copyright (C) 2012-2015 Calum Lind <[email protected]> |
| 4 |
# Copyright (C) 2010 Damien Churchill <[email protected]> |
| 5 |
# Copyright (C) 2009-2010 Andrew Resch <[email protected]> |
| 6 |
# Copyright (C) 2009 Jesper Lund <[email protected]> |
| 7 |
# |
| 8 |
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with |
| 9 |
# the additional special exception to link portions of this program with the OpenSSL library. |
| 10 |
# See LICENSE for more details. |
| 11 |
# |
| 12 |
|
| 13 |
import os |
| 14 |
|
| 15 |
import deluge.common |
| 16 |
|
| 17 |
# Get build_version from installed deluge. |
| 18 |
build_version = deluge.common.get_version() |
| 19 |
build_dir = os.path.join('freeze', 'Deluge') |
| 20 |
|
| 21 |
# Copy version info to file for nsis script. |
| 22 |
with open('VERSION.tmp', 'w') as ver_file: |
| 23 |
ver_file.write('build_version = "%s"' % build_version) |
| 24 |
|
| 25 |
# Create the install and uninstall file list for NSIS. |
| 26 |
filedir_list = [] |
| 27 |
for root, dirnames, filenames in os.walk(build_dir): |
| 28 |
dirnames.sort() |
| 29 |
filenames.sort() |
| 30 |
filedir_list.append((root[len(build_dir) :], filenames)) |
| 31 |
|
| 32 |
with open('install_files.nsh', 'w') as f: |
| 33 |
f.write('; Files to install\n') |
| 34 |
for dirname, files in filedir_list: |
| 35 |
if not dirname: |
| 36 |
dirname = os.sep |
| 37 |
f.write('\nSetOutPath "$INSTDIR%s"\n' % dirname) |
| 38 |
for filename in files: |
| 39 |
f.write('File ' + build_dir + os.path.join(dirname, filename) + '\n') |
| 40 |
|
| 41 |
with open('uninstall_files.nsh', 'w') as f: |
| 42 |
f.write('; Files to uninstall\n') |
| 43 |
for dirname, files in reversed(filedir_list): |
| 44 |
f.write('\n') |
| 45 |
if not dirname: |
| 46 |
dirname = os.sep |
| 47 |
for filename in files: |
| 48 |
f.write('Delete "$INSTDIR%s"\n' % os.path.join(dirname, filename)) |
| 49 |
f.write('RMDir "$INSTDIR%s"\n' % dirname) |