mirror of
https://github.com/fergalmoran/picard.git
synced 2025-12-22 09:18:18 +00:00
PICARD-1675: Disable autoupdate works for pyinstaller and local builds
Generate tagger.py from tagger.py.in
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -28,6 +28,7 @@ picard.egg-info
|
||||
po/attributes/attributes.pot
|
||||
po/countries/countries.pot
|
||||
scripts/picard
|
||||
tagger.py
|
||||
win-version-info.txt
|
||||
|
||||
# Other files
|
||||
|
||||
@@ -91,7 +91,8 @@ before_install:
|
||||
|
||||
script:
|
||||
- py.test -v --cov=picard --cov-report xml:coverage.xml test
|
||||
- python3 setup.py build_locales build_ext -i
|
||||
- python3 setup.py build
|
||||
- python3 setup.py build_ext -i
|
||||
- python3 tagger.py --long-version
|
||||
- isort --check-only --diff --quiet $(git ls-tree -r --name-only $(git rev-parse HEAD) | grep "\\.py$")
|
||||
- flake8 picard
|
||||
|
||||
@@ -4,7 +4,6 @@ prune test
|
||||
recursive-include scripts *.in
|
||||
recursive-exclude scripts picard
|
||||
|
||||
include tagger.py
|
||||
include *.in
|
||||
|
||||
include *.md
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
from picard.tagger import main; main('%(localedir)s', %(autoupdate)s)
|
||||
|
||||
from picard.tagger import main
|
||||
main('%(localedir)s', %(autoupdate)s)
|
||||
|
||||
12
setup.py
12
setup.py
@@ -10,6 +10,7 @@ import glob
|
||||
from io import StringIO
|
||||
import os
|
||||
import re
|
||||
import stat
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
@@ -221,8 +222,10 @@ class picard_build(build):
|
||||
self.sub_commands.append(('build_locales', None))
|
||||
|
||||
def run(self):
|
||||
log.info('generating scripts/%s from scripts/picard.in', PACKAGE_NAME)
|
||||
generate_file('scripts/picard.in', 'scripts/' + PACKAGE_NAME, {'localedir': self.localedir, 'autoupdate': not self.disable_autoupdate})
|
||||
params = {'localedir': self.localedir, 'autoupdate': not self.disable_autoupdate}
|
||||
generate_file('tagger.py.in', 'tagger.py', params)
|
||||
make_executable('tagger.py')
|
||||
generate_file('scripts/picard.in', 'scripts/' + PACKAGE_NAME, params)
|
||||
if sys.platform == 'win32':
|
||||
file_version = PICARD_VERSION[0:3] + (self.build_number,)
|
||||
file_version_str = '.'.join([str(v) for v in file_version])
|
||||
@@ -740,11 +743,16 @@ args = {
|
||||
|
||||
|
||||
def generate_file(infilename, outfilename, variables):
|
||||
log.info('generating %s from %s', outfilename, infilename)
|
||||
with open(infilename, "rt") as f_in:
|
||||
with open(outfilename, "wt") as f_out:
|
||||
f_out.write(f_in.read() % variables)
|
||||
|
||||
|
||||
def make_executable(filename):
|
||||
os.chmod(filename, os.stat(filename).st_mode | stat.S_IEXEC)
|
||||
|
||||
|
||||
def find_file_in_path(filename):
|
||||
for include_path in sys.path:
|
||||
file_path = os.path.join(include_path, filename)
|
||||
|
||||
2
tagger.py → tagger.py.in
Executable file → Normal file
2
tagger.py → tagger.py.in
Executable file → Normal file
@@ -16,4 +16,4 @@ if sys.platform == 'win32':
|
||||
os.environ['PATH'] = basedir + ';' + os.environ['PATH']
|
||||
|
||||
from picard.tagger import main
|
||||
main(os.path.join(basedir, 'locale'), True)
|
||||
main(os.path.join(basedir, 'locale'), %(autoupdate)s)
|
||||
Reference in New Issue
Block a user