From f19ca412f4de3e7df92d5f09781ea250c214bc87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Mon, 19 Mar 2007 22:43:40 +0100 Subject: [PATCH] Added option --disable-autoupdate for 'build' and 'install' commands of the setup script. (#2551) --- NEWS.txt | 3 +++ picard/tagger.py | 14 +++++++++----- scripts/picard.in | 2 +- scripts/picard.py2exe.in | 2 +- setup.py | 12 +++++++++++- tagger.py | 2 +- 6 files changed, 26 insertions(+), 9 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 74567ff1a..ca16cf0d8 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,4 +1,7 @@ Version 0.9.0alpha6 - 2007-03-XX + * New Features: + * Added option --disable-autoupdate for 'build' and 'install' commands + of the setup script. (#2551) * Bug Fixes: * Artist names from ARs should be translated, too. * Freeze after answering no to "download the new version" prompt. (#2542) diff --git a/picard/tagger.py b/picard/tagger.py index fd651b3ba..707b0d9d0 100644 --- a/picard/tagger.py +++ b/picard/tagger.py @@ -103,10 +103,11 @@ class Tagger(QtGui.QApplication): __instance = None - def __init__(self, localedir): + def __init__(self, localedir, autoupdate): QtGui.QApplication.__init__(self, sys.argv) self.__class__.__instance = self + self._autoupdate = autoupdate self.config = Config() if sys.platform == "win32": @@ -269,8 +270,11 @@ class Tagger(QtGui.QApplication): self.xmlws.download('ftp.musicbrainz.org', 80, '/pub/musicbrainz/users/luks/picard-qt/version.txt', self._check_version_request_finished) def _run_init(self): - self._check_version() - self.add_files(map(decode_filename, sys.argv[1:])) + if self._autoupdate: + self._check_version() + files = sys.argv[1:] + if files: + self.add_files(map(decode_filename, files)) def run(self): self.browser_integration.start() @@ -631,6 +635,6 @@ class Tagger(QtGui.QApplication): return len([file for file in self.files.values() if file.state == File.PENDING]) -def main(localedir=None): - tagger = Tagger(localedir) +def main(localedir=None, autoupdate=True): + tagger = Tagger(localedir, autoupdate) sys.exit(tagger.run()) diff --git a/scripts/picard.in b/scripts/picard.in index b3c1b8069..0f4979bd9 100644 --- a/scripts/picard.in +++ b/scripts/picard.in @@ -1,3 +1,3 @@ #!/usr/bin/env python -from picard.tagger import main; main('%(localedir)s') +from picard.tagger import main; main('%(localedir)s', %(autoupdate)s) diff --git a/scripts/picard.py2exe.in b/scripts/picard.py2exe.in index 7e021e449..0085774a2 100644 --- a/scripts/picard.py2exe.in +++ b/scripts/picard.py2exe.in @@ -3,5 +3,5 @@ import sys import os.path from picard.tagger import main basedir = os.path.dirname(sys.argv[0]) -main(os.path.join(basedir, 'locale')) +main(os.path.join(basedir, 'locale'), True) diff --git a/setup.py b/setup.py index d9ddc5af8..114803dcc 100755 --- a/setup.py +++ b/setup.py @@ -160,6 +160,7 @@ class picard_install(install): ('install-locales=', None, "installation directory for locales"), ('localedir=', None, ''), + ('disable-autoupdate', None, ''), ] sub_commands = install.sub_commands + [ @@ -170,6 +171,7 @@ class picard_install(install): install.initialize_options(self) self.install_locales = None self.localedir = None + self.disable_autoupdate = None def finalize_options(self): install.finalize_options(self) @@ -180,6 +182,7 @@ class picard_install(install): self.localedir = self.install_locales # can't use set_undefined_options :/ self.distribution.get_command_obj('build').localedir = self.localedir + self.distribution.get_command_obj('build').disable_autoupdate = self.disable_autoupdate if self.root is not None: self.change_roots('locales') @@ -191,6 +194,8 @@ class picard_build(build): user_options = build.user_options + [ ('build-locales=', 'd', "build directory for locale files"), + ('localedir=', None, ''), + ('disable-autoupdate', None, ''), ] sub_commands = build.sub_commands + [ @@ -201,15 +206,20 @@ class picard_build(build): build.initialize_options(self) self.build_locales = None self.localedir = None + self.disable_autoupdate = None def finalize_options(self): build.finalize_options(self) if self.build_locales is None: self.build_locales = os.path.join(self.build_base, 'locale') + if self.localedir is None: + self.localedir = '/usr/share/locale' + if self.disable_autoupdate is None: + self.disable_autoupdate = False def run(self): log.info('generating scripts/picard from scripts/picard.in') - generate_file('scripts/picard.in', 'scripts/picard', {'localedir': self.localedir}) + generate_file('scripts/picard.in', 'scripts/picard', {'localedir': self.localedir, 'autoupdate': not self.disable_autoupdate}) build.run(self) diff --git a/tagger.py b/tagger.py index 800f038e1..f854d93c7 100755 --- a/tagger.py +++ b/tagger.py @@ -7,5 +7,5 @@ sys.path.insert(0, '.') from picard.tagger import main localedir = os.path.join(os.path.dirname(sys.argv[0]), 'locale') -main(localedir) +main(localedir, True)