1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 14:41:39 +00:00

Added debian packaging support.

This commit is contained in:
Virgil Dupras
2010-04-07 03:56:43 -07:00
parent 88334acdef
commit e63abc1b4b
16 changed files with 408 additions and 4 deletions

View File

@@ -10,11 +10,12 @@
import sys
import os
import os.path as op
import compileall
import shutil
import yaml
from hsutil.build import build_dmg, add_to_pythonpath, print_and_do
from hsutil.build import build_dmg, add_to_pythonpath, print_and_do, copy_packages, build_debian_changelog
def package_cocoa(edition):
app_path = {
@@ -24,7 +25,7 @@ def package_cocoa(edition):
}[edition]
build_dmg(app_path, '.')
def package_qt(edition):
def package_windows(edition):
# On Windows, PyInstaller is used to build an exe (py2exe creates a very bad looking icon)
# The release version is outdated. Use at least r672 on http://svn.pyinstaller.org/trunk
if sys.platform != "win32":
@@ -64,6 +65,40 @@ def package_qt(edition):
os.remove('installer_tmp.aip')
os.chdir(op.join('..', '..'))
def package_debian(edition):
add_to_pythonpath('qt')
add_to_pythonpath(op.join('qt', edition))
from app import DupeGuru
if op.exists('build'):
shutil.rmtree('build')
ed = lambda s: s.format(edition)
destpath = op.join('build', 'dupeguru-{0}-{1}'.format(edition, DupeGuru.VERSION))
srcpath = op.join(destpath, 'src')
help_src = ed('help_{0}')
os.makedirs(destpath)
shutil.copytree(ed('qt/{0}'), srcpath)
packages = ['hsutil', 'hsgui', 'core', ed('core_{0}'), 'qtlib', 'qt/base']
if edition == 'me':
packages.append('hsmedia')
copy_packages(packages, srcpath)
# We also have to copy the Send2Trash package
import send2trash
pkg_path = op.dirname(send2trash.__file__)
shutil.copytree(pkg_path, op.join(srcpath, 'send2trash'))
shutil.copytree(ed('debian_{0}'), op.join(destpath, 'debian'))
yaml_path = op.join(help_src, 'changelog.yaml')
changelog_dest = op.join(destpath, 'debian', 'changelog')
project_name = ed('dupeguru-{0}')
from_version = {'se': '2.9.2', 'me': '5.7.2', 'pe': '1.8.5'}[edition]
build_debian_changelog(yaml_path, changelog_dest, project_name, from_version=from_version)
help_name = {'se': 'dupeguru_help', 'me': 'dupeguru_me_help', 'pe': 'dupeguru_pe_help'}[edition]
shutil.copytree(op.join(help_src, help_name), op.join(srcpath, 'help'))
shutil.copy(op.join('images', ed('dg{0}_logo_128.png')), srcpath)
compileall.compile_dir(srcpath)
os.chdir(destpath)
os.system("dpkg-buildpackage")
def main():
conf = yaml.load(open('conf.yaml'))
edition = conf['edition']
@@ -76,7 +111,12 @@ def main():
if ui == 'cocoa':
package_cocoa(edition)
elif ui == 'qt':
package_qt(edition)
if sys.platform == "win32":
package_windows(edition)
elif sys.platform == "linux2":
package_debian(edition)
else:
print "Qt packaging only works under Windows or Linux."
if __name__ == '__main__':
main()
main()