New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onboard: 1.4.1 #24986
onboard: 1.4.1 #24986
Conversation
We have the function |
@FRidh I'll take another look. I guess I was incorrect when I thought the python specific functions were just for pip packages. Another thing, when following the manual it says in the quick start section
When trying that on NixOS after cloning the repo I get
and I have to run it from the package's directory to get it to work. What am I doing wrong? |
Write down exactly what you do, since the error message you give does not correspond to the code you show here. |
After cloning the repo and setting up my package: run the following command from the root of the nixpkgs source tree: $ nix-build -A -K onboard
|
@@ -0,0 +1,45 @@ | |||
{ gtk3, python3, hunspell, isocodes, libcanberra_gtk3, xorg.libxkbfile, libxkbcommon, python35Packages.pycairo, python35Packages.dbus-python, python35Packages.pygobject3, python35Packages.systemd, libudev, python35Packages.distutils_extra, gnome3.dconf, pkgconfig, xorg.libXtst |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using dot operator here is invalid syntax. Just import python35Packages and xorg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's strange, I fixed that in the previous commit, I guess I undid the change by accident.
I tried to convert to use |
So i've tested building and it seems to work until an issue with it being unable to find symlinked files, I think it's possibly related to issue 1232.
It occurs in the setup.py, in this code: def symlink_extension_libraries(setup_command):
"""
Link the extensions back to the project directory
so Onboard can be run from source as usual, without --inplace.
Remove this at any time if there is a better way.
"""
if setup_command in ["build", "build_ext"]:
for path, pattern in libs_to_symlink:
files = glob.glob(join(build_root, path, pattern))
for file in files:
dstfile = join(path, split(file)[1])
print("symlinking {} to {}".format(file, dstfile))
try: os.unlink(dstfile)
except OSError: pass
os.symlink(file, dstfile)
# Make xgettext extract translatable strings from _format() calls too.
var = "XGETTEXT_ARGS"
os.environ[var] = os.environ.get(var, "") + " --keyword=_format"
# scan for translatable layout strings in layouts
# disabled until know how to make it work.
# layoutstring.px has those string manually added now.
if 0:
if "build_i18n" in sys.argv:
args = ["./tools/gen_i18n_strings",
"-o./data/layoutstrings_generated.py"]
print("Running '{}'".format(" ".join(args)))
subprocess.check_call(args)
clean_before_build(setup_command) Any advice? |
I opened a question on onboards launchpad page in case they could help. |
So, I was told the 'attic directory wasn't necesary anyway and removed it in the preBuild. preBuild = ''
rm -r Onboard/pypredict/attic
sed -i 's:/bin/bash:${bash}/bin/bash:' ./setup.py
'';
Now i'm getting:
|
So the onboard guys gave me some input and I was able to get onboard building, I'm getting some errors though when run. I'm not sure if it's a Nix thing or an onboard thing. I also changed things to use the Nix specific functions. I'm now getting the following error when onboard is run:
|
It looks like some typelibs are missing.
I have found the typelibs in |
@FRidh I tried wrapping the package but it didn't help.
Is there a better way to set the typelibs? |
Should I repost this as an issue? |
Okay, I finally made some progress. Adding the packages gobjectIntrospection gsettings_desktop_schemas, and wrapGAppsHook it seems to boot but now I'm getting a different error:
|
Whoo! Got it running. Just need to fix a few errors and it should be ready! |
The issue with seems to be related to how the file sokSettings.py is being wrapped. I'm using wrapGAppsHook and the program wants to import a module but it is importing the bash script wrapper which actually calls the module, instead of importing the Python module. Does anyone know if there is a way to exclude certain files with the wrappers? When the Python script attempts to import sokSettings.py the following happens:
This is what it should be importing:
|
Now the setting application actually runs. I hardcoded it to execute the specific executable of the settings module, how it was set before stopped settings from starting.
This ends up giving us the following:
The issue is the settings application doesn't do anything. It won't change any settings. I'm wondering if it could be related to the fact that the store is considered read only? |
--replace "/usr/lib" "$out/lib" | ||
|
||
substituteInPlace ./data/org.onboard.Onboard.service \ | ||
--replace "/usr/bin" "out/bin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are missing '$' in $out here and below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
So, marmuta from onboard thinks it might have something to do with 'gsettings'.
I tried adding a few packages that I thought might might provide gsettings as build inputs, but it doesn't seem to do anything or add the package.
I'm not sure what should be providing gsettings. |
For some reason glib schemas are not being installed. I posted an issue regarding the problem. |
It looks like the problem I was getting with the settings was not related to the glib schema compilation. I found out that the fix was to install I reverted the schema back to how it was before, which seems to be working. The on-screen keyboard is now in a usable state. I'm now working on getting rid of the remaining warnings that show up at the start of the program:
|
Got rid of last few warnings. Added at_spi2_core as optional, enabling atspiSupport gets rid of warning:
Enable service 'services.gnome3.at-spi2-core.enable = true' to get rid of warning:
|
Yes, this should be enough. |
I will test it later but it looks good to merge. In the future, we might want to look into the remaining test failures, probably in cooperation with upstream. We will also want to allow users to chose which hunspell dictionaries to install. |
@jtojnar That sounds like a good idea, adding the ability to choose which dictionaries to use could be customized with install options in the future. I've never tried using the dictionary so I'm not sure how they work, but I tried enabling word suggestions and the keyboard would no longer open, so something must be wrong. I have found Upstream to be very responsive to issues in the past so I'm sure if we asked them they would give us a hand. At least now the core functionality of the keyboard is working though, which is great for accessibility on NixOS. The current alternative xvkbd works, but Onboard is a much better keyboard. If you think it is ready to merge, to make things easier should I squash my commits? @jtojnar Thanks for all your help getting things working properly, your help is much appreciated. |
Typically these kind of things are kept impure for during runtime, that is, you need to explicitly install yourself hunspell with certain dictionaries. The reason is that one otherwise would have to copy interfaces and because its unlikely that you would need multiple versions of hunspell during runtime. I leave it open whether you should do it like this or not. |
In that case we would want to replace |
My bad, I misread |
@jtojnar in other words, change I couldn't figure out how the spell-checker was supposed to work either. |
No, that would not work. === modified file 'Onboard/SpellChecker.py'
--- Onboard/SpellChecker.py 2015-02-10 00:09:01 +0000
+++ Onboard/SpellChecker.py 2017-12-05 14:49:31 +0000
@@ -506,6 +506,10 @@
if dicpath:
paths.extend(dicpath.split(pathsep))
+ datadirs = os.getenv("XDG_DATA_DIRS")
+ if datadirs:
+ paths.extend(map(lambda datadir: os.path.join(datadir, 'hunspell'), datadirs.split(pathsep)))
+
paths.extend(LIBDIRS)
home = os.getenv("HOME")
|
Okay, I'll apply the patch and set the path to what then? |
No need for substitution then. I would also move some things around and add more comments: --- a/pkgs/applications/misc/onboard/default.nix
+++ b/pkgs/applications/misc/onboard/default.nix
@@ -28,11 +28,10 @@
let
customHunspell = hunspellWithDicts [hunspellDicts.en-us];
-in
-python3.pkgs.buildPythonApplication rec {
- name = "onboard-${version}";
majorVersion = "1.4";
version = "${majorVersion}.1";
+in python3.pkgs.buildPythonApplication rec {
+ name = "onboard-${version}";
src = fetchurl {
url = "https://launchpad.net/onboard/${majorVersion}/${version}/+download/${name}.tar.gz";
sha256 = "01cae1ac5b1ef1ab985bd2d2d79ded6fc99ee04b1535cc1bb191e43a231a3865";
@@ -43,8 +42,14 @@
doCheck = false;
checkInputs = [
python3.pkgs.nose
+ # for Onboard.SpellChecker.hunspell_cmd doctests
customHunspell
+ # for Onboard.SpellChecker.aspell_cmd doctests
(aspellWithDicts (dicts: with dicts; [ en ]))
+ # for Onboard.SpellChecker.hunspell doctests
+ hunspellDicts.en-us
+ hunspellDicts.es-es
+ hunspellDicts.it-it
];
propagatedBuildInputs = [
@@ -83,6 +88,11 @@
gnome3.dconf
];
+ patches = [
+ # Allow loading hunspell dictionaries installed in NixOS system path
+ ./use-xdg-datadirs.patch
+ ];
+
preBuild = ''
# Unnecessary file, has been removed upstream
# https://github.com/NixOS/nixpkgs/pull/24986#issuecomment-296114062
@@ -108,7 +118,6 @@
--replace "/usr/bin/yelp" "${yelp}/bin/yelp"
substituteInPlace ./Onboard/SpellChecker.py \
- --replace "/usr/share/hunspell" hunspell \
--replace "/usr/lib" "$out/lib"
substituteInPlace ./data/org.onboard.Onboard.service \ |
meta = { | ||
homepage = https://launchpad.net/onboard; | ||
description = "An onscreen keyboard useful for tablet PC users and for mobility impaired users."; | ||
longDescription = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would get rid of the long description. dconf is now added automatically thanks to propagatedUserEnvPkgs
, changing advanced configuration is not NixOS specific, the a11y bus is not specific to this package… The only thing that matters is hunspell and we are do not even know how to use it.
I went ahead and added the patch, as well as some comments, and did a bit of reorganizing. |
in python3.pkgs.buildPythonApplication rec { | ||
name = "onboard-${version}"; | ||
majorVersion = "1.4"; | ||
version = "${majorVersion}.1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is preferred to move the helper definitions (like version) to the let
statement in order not to pollute the build environment.
postInstall = '' | ||
cp onboard-default-settings.gschema.override.example $out/share/glib-2.0/schemas/10_onboard-default-settings.gschema.override | ||
|
||
${glib.dev}/bin/glib-compile-schemas $out/share/glib-2.0/schemas/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for absolute path to glib-compile-schemas
since it is already on path, thanks to being in build inputs.
@@ -0,0 +1,157 @@ | |||
{ config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I I think that remains from when I was using it as one of my own custom packages. I'll remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your great work, you can squash it now and I will merge it.
The commit message seems to mention uncommenting |
Add testing reqs, but keep tests disabled Tests are runnable but still produce errors. To get tests working, add locale setting, replace killall and add nose package. To run the tests enable 'doCheck'. Hunspell needs to be explicitly installed to use. Patch SpellCheck.py to put hunspell in system datadir location. For example, '/var/run/current-system/sw/share/hunspell/' or '${HOME}/.nix-profile/share/hunspell/' To get rid of atspi errors set 'services.gnome3.at-spi2-core.enable = true'
@jtojnar Where are you referring to? |
@jtojnar Whoops, fixed. |
Thanks. |
@jtojnar Thanks for being so patient with me. I appreciate your help in getting this to work. |
Hmm, it should be possible to make the dconf tests work with nixpkgs/pkgs/applications/office/paperwork/default.nix Lines 58 to 59 in 9adbe64
|
@jtojnar Interesting. How exactly would I go about replacing the check command that's run with |
@johnramsden Simply replacing the --- a/pkgs/applications/misc/onboard/default.nix
+++ b/pkgs/applications/misc/onboard/default.nix
@@ -3,6 +3,7 @@
, aspellWithDicts
, at_spi2_core ? null
, atspiSupport ? true
+, dbus
, bash
, glib
, glibcLocales
@@ -57,6 +59,7 @@ in python3.pkgs.buildPythonApplication rec {
hunspellDicts.es-es
hunspellDicts.it-it
+ dbus.daemon
python3.pkgs.nose
];
@@ -147,6 +151,12 @@ in python3.pkgs.buildPythonApplication rec {
glib-compile-schemas $out/share/glib-2.0/schemas/
'';
+ checkPhase = ''
+ dbus-run-session \
+ --config-file=${dbus.daemon}/share/dbus-1/session.conf \
+ python setup.py test
+ '';
+
meta = {
homepage = https://launchpad.net/onboard;
description = "An onscreen keyboard useful for tablet PC users and for mobility impaired users."; Though now it seems to hang for me. |
@jtojnar Yea, the test seems to run but I get a lot of failures still, and it seems to hang that you mentioned. I'm not even sure where to start. I wonder if we should wait for some help from the onboard guys regarding the tests. |
I suspect the checkPhase = ''
export PYTHONPATH="$out/lib/${python3.libPrefix}/site-packages:$PYTHONPATH"
export PYDIR=$out/lib/${python3.libPrefix}/site-packages
export XDG_DATA_DIRS="$out/share:$XDG_DATA_DIRS"
export GIO_EXTRA_MODULES="$out/lib/gio/modules:$GIO_EXTRA_MODULES"
dbus-run-session \
--config-file=${dbus.daemon}/share/dbus-1/session.conf \
sh -c " \
${gnome3.dconf.lib}/libexec/dconf-service & \
python setup.py test
"
''; Maybe some Nix Python people might help too. |
Motivation for this change
onboard is a great on-screen keyboard and in my opinion should be in the repo.
Everything is working and there are no errors at runtime.
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
./result/bin/
)