Add an option to control the default update_check_interval when building kitty packages

Fixes #1675
This commit is contained in:
Kovid Goyal 2019-06-04 14:27:28 +05:30
parent 8f8a37bf94
commit a75d075dd1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 19 additions and 3 deletions

View File

@ -115,5 +115,5 @@ brew or MacPorts as well.
.. note::
|kitty| has its own update check mechanism, if you would like to turn
it off for your package, change the default value of
:opt:`update_check_interval` to zero.
it off for your package, use
``python3 setup.py linux-package --update-check-interval=0``

View File

@ -22,6 +22,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- panel kitten: Fix the contents of the panel kitten not being positioned
correctly on the vertical axis
- Add an option to control the default :opt:`update_check_interval` when
building kitty packages
0.14.1 [2019-05-29]
---------------------

View File

@ -657,6 +657,12 @@ def package(args, for_bundle=False, sh_launcher=False):
shutil.copytree('kitty', os.path.join(libdir, 'kitty'), ignore=src_ignore)
shutil.copytree('kittens', os.path.join(libdir, 'kittens'), ignore=src_ignore)
with open(os.path.join(libdir, 'kitty/config_data.py'), 'r+', encoding='utf-8') as f:
raw = f.read()
nraw = raw.replace("update_check_interval', 24", "update_check_interval', {}".format(args.update_check_interval), 1)
if nraw == raw:
raise SystemExit('Failed to change the value of update_check_interval')
f.seek(0), f.truncate(), f.write(nraw)
compile_python(libdir)
for root, dirs, files in os.walk(libdir):
for f in files:
@ -854,7 +860,14 @@ def option_parser(): # {{{
default=[],
choices=('event-loop',),
help='Turn on extra logging for debugging in this build. Can be specified multiple times, to turn'
'on different types of logging.'
' on different types of logging.'
)
p.add_argument(
'--update-check-interval',
type=float,
default=24,
help='When building a package, the default value for the update_check_interval setting will'
' be set to this number. Use zero to disable update checking.'
)
return p
# }}}