Brian Silverman | b0ebf1d | 2018-10-17 23:36:40 -0700 | [diff] [blame] | 1 | --- a/__init__.py 1969-12-31 16:00:00.000000000 -0800 |
| 2 | +++ b/__init__.py 2018-10-17 21:45:04.908201161 -0700 |
Philipp Schrader | bde36ad | 2022-02-26 16:18:41 -0800 | [diff] [blame] | 3 | @@ -29,6 +29,22 @@ import os |
Brian Silverman | b0ebf1d | 2018-10-17 23:36:40 -0700 | [diff] [blame] | 4 | import importlib |
| 5 | import types |
| 6 | |
| 7 | +_base = os.path.dirname(os.path.dirname(__file__)) |
| 8 | +os.environ['GI_TYPELIB_PATH'] = os.path.join(_base, 'usr', 'lib', |
| 9 | + 'x86_64-linux-gnu', |
| 10 | + 'girepository-1.0') |
| 11 | + |
James Kuszmaul | 58683ed | 2020-01-25 20:33:11 -0800 | [diff] [blame] | 12 | +# Tell fontconfig where to find the sandboxed font files. |
| 13 | +os.environ["FONTCONFIG_PATH"] = os.path.join(_base, "etc/fonts/") |
| 14 | +os.environ["FONTCONFIG_FILE"] = os.path.join(_base, "etc/fonts/fonts.conf") |
Philipp Schrader | bde36ad | 2022-02-26 16:18:41 -0800 | [diff] [blame] | 15 | +# The sysroot here needs to be "/". If it were _base, then the font caches |
| 16 | +# would contain _base-relative paths in them. Unfortunately pango interprets |
| 17 | +# those as absolute paths and ends up failing to find all fonts. |
| 18 | +os.environ["FONTCONFIG_SYSROOT"] = "/" |
Austin Schuh | 903b99a | 2021-02-06 13:41:34 -0800 | [diff] [blame] | 19 | +os.environ["GDK_PIXBUF_MODULEDIR"] = os.path.join(_base, "rpathed", "usr", "lib", "x86_64-linux-gnu", "gdk-pixbuf-2.0", "2.10.0", "loaders") |
| 20 | +os.environ["GDK_PIXBUF_MODULE_FILE"] = os.path.join(os.environ["GDK_PIXBUF_MODULEDIR"], "loaders.cache") |
| 21 | +os.system(os.path.join(_base, "usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders") + " --update-cache") |
James Kuszmaul | 58683ed | 2020-01-25 20:33:11 -0800 | [diff] [blame] | 22 | + |
Brian Silverman | b0ebf1d | 2018-10-17 23:36:40 -0700 | [diff] [blame] | 23 | _static_binding_error = ('When using gi.repository you must not import static ' |
| 24 | 'modules like "gobject". Please change all occurrences ' |
| 25 | 'of "import gobject" to "from gi.repository import GObject". ' |