mirror of
https://github.com/fergalmoran/picard.git
synced 2026-03-22 21:25:14 +00:00
Added option --disable-autoupdate for 'build' and 'install' commands of the setup script. (#2551)
This commit is contained in:
3
NEWS.txt
3
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)
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
12
setup.py
12
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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user