Add an environment variable (CALIBRE_NO_DEFAULT_PROGRAMS) to prevent calibre from automatically registering with the Open With subsystem on windows

This commit is contained in:
Kovid Goyal 2016-04-14 08:12:25 +05:30
parent ebf91eab18
commit 220064441c
2 changed files with 4 additions and 1 deletions

View File

@ -30,10 +30,11 @@ Environment variables
* ``CALIBRE_DEVELOP_FROM`` - Used to run from a calibre development environment. See :ref:`develop`. * ``CALIBRE_DEVELOP_FROM`` - Used to run from a calibre development environment. See :ref:`develop`.
* ``CALIBRE_OVERRIDE_LANG`` - Used to force the language used by the interface (ISO 639 language code) * ``CALIBRE_OVERRIDE_LANG`` - Used to force the language used by the interface (ISO 639 language code)
* ``CALIBRE_TEST_TRANSLATION`` - Used to test a translation .po file (should be the path to the .po file) * ``CALIBRE_TEST_TRANSLATION`` - Used to test a translation .po file (should be the path to the .po file)
* ``CALIBRE_NO_NATIVE_FILEDIALOGS`` - Causes calibre to not use native file dialogs for selecting files/directories. Set it to 1 to enable. * ``CALIBRE_NO_NATIVE_FILEDIALOGS`` - Causes calibre to not use native file dialogs for selecting files/directories.
* ``CALIBRE_NO_NATIVE_MENUBAR`` - Causes calibre to not create a native (global) menu on Ubuntu Unity and similar linux desktop environments. The menu is instead placed inside the window, as traditional. * ``CALIBRE_NO_NATIVE_MENUBAR`` - Causes calibre to not create a native (global) menu on Ubuntu Unity and similar linux desktop environments. The menu is instead placed inside the window, as traditional.
* ``CALIBRE_IGNORE_SYSTEM_THEME`` - Causes calibre to ignore any system Qt style plugins and use its builtin style plugin instead. Useful to workaround crashes caused by the system Qt plugin being incompatible with the version of Qt shipped with calibre. * ``CALIBRE_IGNORE_SYSTEM_THEME`` - Causes calibre to ignore any system Qt style plugins and use its builtin style plugin instead. Useful to workaround crashes caused by the system Qt plugin being incompatible with the version of Qt shipped with calibre.
* ``CALIBRE_SHOW_DEPRECATION_WARNINGS`` - Causes calibre to print deprecation warnings to stdout. Useful for calibre developers. * ``CALIBRE_SHOW_DEPRECATION_WARNINGS`` - Causes calibre to print deprecation warnings to stdout. Useful for calibre developers.
* ``CALIBRE_NO_DEFAULT_PROGRAMS`` - Prevent calibre from automatically registering the filetypes it is capable of handling with windows.
* ``SYSFS_PATH`` - Use if sysfs is mounted somewhere other than /sys * ``SYSFS_PATH`` - Use if sysfs is mounted somewhere other than /sys
* ``http_proxy`` - Used on linux to specify an HTTP proxy * ``http_proxy`` - Used on linux to specify an HTTP proxy

View File

@ -69,6 +69,8 @@ def check_allowed():
raise NotAllowed('Not allowed to create associations for portable installs') raise NotAllowed('Not allowed to create associations for portable installs')
if sys.getwindowsversion()[:2] < (6, 2): if sys.getwindowsversion()[:2] < (6, 2):
raise NotAllowed('Not allowed to create associations for windows versions older than Windows 8') raise NotAllowed('Not allowed to create associations for windows versions older than Windows 8')
if b'CALIBRE_NO_DEFAULT_PROGRAMS' in os.environ:
raise NotAllowed('Disabled by the CALIBRE_NO_DEFAULT_PROGRAMS environment variable')
def create_prog_id(ext, prog_id, ext_map, exe): def create_prog_id(ext, prog_id, ext_map, exe):
with Key(r'Software\Classes\%s' % prog_id) as key: with Key(r'Software\Classes\%s' % prog_id) as key: