Merge branch 'tfuxu-local-build-fix'

This commit is contained in:
0xMRTT 2022-09-13 21:00:41 +02:00
commit 7fb8777aaf
No known key found for this signature in database
GPG key ID: AC9E06BF3DECB6FB
37 changed files with 65 additions and 27 deletions

2
.gitignore vendored
View file

@ -214,3 +214,5 @@ cython_debug/
.vscode/ .vscode/
flatpak-pip-generator flatpak-pip-generator
gradience/constants.py

View file

@ -7,6 +7,6 @@ global:
sudo ninja -C builddir install sudo ninja -C builddir install
user: user:
meson builddir --prefix="$(shell pwd)/builddir/testdir" --wipe meson builddir --prefix="$(shell pwd)/builddir" --buildtype=debug --wipe
ninja -C builddir install ninja -C builddir install
ninja -C builddir run ninja -C builddir run

View file

@ -0,0 +1,9 @@
#!/usr/bin/env python3
import os
import subprocess
build_root = os.environ.get('MESON_BUILD_ROOT')
source_root = os.environ.get('MESON_SOURCE_ROOT')
subprocess.call(['mv', build_root, 'gradience/constants.py', source_root, 'gradience/constants.py'])

View file

@ -28,7 +28,7 @@ gnome.compile_resources('gradience',
source_dir: meson.current_build_dir(), source_dir: meson.current_build_dir(),
install: true, install: true,
install_dir: PKGDATA_DIR, install_dir: PKGDATA_DIR,
dependencies: blueprints, dependencies: blueprints
) )
appstream_file = i18n.merge_file( appstream_file = i18n.merge_file(

View file

@ -16,5 +16,5 @@ blueprints = custom_target('blueprints',
'repo_row.blp', 'repo_row.blp',
), ),
output: '.', output: '.',
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@']
) )

View file

@ -1,4 +1,4 @@
#!@PYTHON@ #!/usr/bin/env python3
# gradience.in # gradience.in
# #
@ -9,12 +9,12 @@
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
@ -24,18 +24,20 @@ import signal
import locale import locale
import gettext import gettext
is_local = @local_build@
if is_local:
# In the local use case, use gradience module from the sourcetree
sys.path.insert(1, '@PYTHON@')
# In the local use case the installed schemas go in <builddir>/data
os.environ["XDG_DATA_DIRS"] = '@SCHEMAS_DIR@:' + os.environ.get("XDG_DATA_DIRS", "")
pkgdatadir = '@PKGDATA_DIR@' pkgdatadir = '@PKGDATA_DIR@'
localedir = '@LOCALE_DIR@' localedir = '@LOCALE_DIR@'
builddir = os.environ.get('MESON_BUILD_ROOT') sys.dont_write_bytecode = True
if builddir:
sys.dont_write_bytecode = True
sys.path.insert(1, os.environ['MESON_SOURCE_ROOT'])
data_dir = os.path.join(builddir, '@DATA_DIR@')
os.putenv('XDG_DATA_DIRS', '%s:%s' % (data_dir, os.getenv('XDG_DATA_DIRS', '/usr/local/share/:/usr/share/')))
sys.path.insert(1, pkgdatadir)
signal.signal(signal.SIGINT, signal.SIG_DFL) signal.signal(signal.SIGINT, signal.SIG_DFL)
gettext.install('gradience', localedir) gettext.install('gradience', localedir)
@ -51,15 +53,12 @@ if __name__ == '__main__':
gi.require_version('Xdp', '1.0') gi.require_version('Xdp', '1.0')
gi.require_version('XdpGtk4', '1.0') gi.require_version('XdpGtk4', '1.0')
if '@BUILD_TYPE@' == "debug":
sys.path.append("/usr/local/local/lib/python3.10/site-packages")
from gi.repository import Gio from gi.repository import Gio
resource = Gio.Resource.load( resource = Gio.Resource.load(
os.path.join(pkgdatadir, 'gradience.gresource')) os.path.join(pkgdatadir, 'gradience.gresource'))
resource._register() Gio.Resource._register(resource)
sys.path.append("/usr/local/lib/python3.10/site-packages/") sys.path.insert(1, "/usr/local/lib/python3.10/site-packages")
from gradience import main from gradience import main
sys.exit(main.main()) sys.exit(main.main())

View file

@ -2,10 +2,15 @@ configure_file(
input: 'gradience.in', input: 'gradience.in',
output: 'gradience', output: 'gradience',
configuration: conf, configuration: conf,
install: true,
install_dir: get_option('bindir') install_dir: get_option('bindir')
) )
configure_file(
input: 'gradience.in',
output: 'local-gradience',
configuration: local_conf
)
configure_file( configure_file(
input: 'constants.py.in', input: 'constants.py.in',
output: 'constants.py', output: 'constants.py',
@ -23,7 +28,7 @@ configure_file(
install_dir: PY_INSTALLDIR.get_install_dir() / 'gradience', install_dir: PY_INSTALLDIR.get_install_dir() / 'gradience',
) )
launcher = join_paths(meson.project_build_root(), 'src', meson.project_name()) launcher = join_paths(meson.project_build_root(), 'gradience', 'local-' + meson.project_name())
run_target('run', run_target('run',
command: [launcher] command: [launcher]
@ -54,7 +59,6 @@ gradience_sources = [
] ]
PY_INSTALLDIR.install_sources(gradience_sources, subdir: 'gradience') PY_INSTALLDIR.install_sources(gradience_sources, subdir: 'gradience')
#install_data(gradience_sources, install_dir: MODULE_DIR)
# Install modules # Install modules
gradience_modules = [ gradience_modules = [

View file

@ -21,7 +21,7 @@ import time
from gi.repository import Gtk, Adw, Gio from gi.repository import Gtk, Adw, Gio
from .run_async import RunAsync from .modules.run_async import RunAsync
from .modules.utils import buglog from .modules.utils import buglog
from .modules.flatpak_overrides import ( from .modules.flatpak_overrides import (
create_gtk_user_override, create_gtk_user_override,

View file

@ -1,7 +1,9 @@
#!/usr/bin/bash #!/usr/bin/bash
# local.sh
# #
# Change the look of Adwaita, with ease # Change the look of Adwaita, with ease
# Copyright (C) 2022 Gradience Team # Copyright (C) 2022 Gradience Team
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -19,8 +21,11 @@
read -p "Do you want to install Python requirements? (yes, no): " answer read -p "Do you want to install Python requirements? (yes, no): " answer
#is_venv = "python -c 'import sys; print(sys.prefix == sys.base_prefix)'"
#if [[ "$is_venv" == "True" ]]; then
if [[ "$answer" == "yes" ]]; then if [[ "$answer" == "yes" ]]; then
pip3 install --user -r requirements.txt pip3 install -r requirements.txt
elif [[ "$answer" == "no" ]]; then elif [[ "$answer" == "no" ]]; then
echo "Skipping requirements installation" echo "Skipping requirements installation"
fi fi
@ -30,7 +35,7 @@ rm -r builddir
echo "Rebuilding" echo "Rebuilding"
meson builddir meson builddir
meson configure builddir -Dprefix="$(pwd)/builddir/testdir" -Dbuildtype=debug meson configure builddir -Dprefix="$(pwd)/builddir" -Dbuildtype=debug
ninja -C builddir install ninja -C builddir install
echo "Running" echo "Running"

View file

@ -60,12 +60,29 @@ conf.set('LOCALE_DIR', join_paths(get_option('prefix'), get_option('localedir'))
conf.set('PYTHON', PY_INSTALLDIR.full_path()) conf.set('PYTHON', PY_INSTALLDIR.full_path())
conf.set('VERSION', meson.project_version() + VERSION_SUFFIX) conf.set('VERSION', meson.project_version() + VERSION_SUFFIX)
conf.set('BUILD_TYPE', get_option('buildtype')) conf.set('BUILD_TYPE', get_option('buildtype'))
conf.set('SCHEMAS_DIR', PKGDATA_DIR)
conf.set('local_build', 'False')
# Local install configuration data
local_conf = configuration_data()
local_conf.set('APP_ID', APPLICATION_ID)
local_conf.set('PKGDATA_DIR', join_paths(meson.current_build_dir(), 'data'))
local_conf.set('LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
local_conf.set('PYTHON', meson.current_source_dir())
local_conf.set('VERSION', meson.project_version() + VERSION_SUFFIX)
local_conf.set('BUILD_TYPE', get_option('buildtype'))
local_conf.set('SCHEMAS_DIR', join_paths(meson.current_build_dir(), 'data'))
local_conf.set('local_build', 'True')
# Subdirs # Subdirs
subdir('gradience')
subdir('data') subdir('data')
subdir('src')
subdir('po') subdir('po')
#meson.add_install_script('build-aux/meson_post_install.py')
gnome.post_install( gnome.post_install(
glib_compile_schemas: true, glib_compile_schemas: true,
gtk_update_icon_cache: true, gtk_update_icon_cache: true,

View file

@ -21,6 +21,8 @@
# chmod +x flatpak-pip-generator # chmod +x flatpak-pip-generator
# Then run: # Then run:
# ./flatpak-pip-generator --requirements-file=requirements.txt --output pypi-dependencies # ./flatpak-pip-generator --requirements-file=requirements.txt --output pypi-dependencies
# And move output file to build-aux directory:
# mv pypi-dependencies.json build-aux/flatpak/
# #
# or more simply, just push and the bot will do this for you. # or more simply, just push and the bot will do this for you.