Skip to content
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

QGIS: 2.18.17 -> 3.0.1 plus required libs #38022

Closed
wants to merge 4 commits into from

Conversation

coreyoconnor
Copy link
Contributor

@coreyoconnor coreyoconnor commented Mar 28, 2018

I think the wrapper could use some improvements, but it's functional.

Motivation for this change
  1. update QGIS to 3.0.1
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@@ -10065,6 +10065,27 @@ in {
};
};

OWSLib = buildPythonPackage rec {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this to a separate file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. There is a mix of inline and separate file in python-packages. Is the standard to move to separate file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the past having module expressions in this file was okay; nowadays, we are moving them to separate files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are moving Python expressions out of pkgs/top-level/python-packages.nix into pkgs/development/python-modules/<module>/default.nix.

Please move the expression there, and call it from pkgs/top-level/python-packages.nix using callPackage ../development/python-modules/<package> { };.

sha256 = "0m05225g1sqd2i8r2riaan33953hfni9wjq7n225snhl7klsb5gc";
};

buildInputs = with self; [ dateutil pep8 pillow pyproj pytz pytest pytestcov requests tox ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these should probably go to checkInputs.

meta = {
description = "Client programming with Open Geospatial Consortium (OGC) web service.";
license = licenses.bsd3;
homepage = "http://geopython.github.io/OWSLib/";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URLs need not be quoted.

meta = {
description = "Client programming with Open Geospatial Consortium (OGC) web service.";
license = licenses.bsd3;
homepage = "http://geopython.github.io/OWSLib/";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URLs do not need to be quoted.

@@ -0,0 +1,12 @@
diff -u -r orig/Python/configure.py QScintilla_gpl-2.10.3/Python/configure.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definitely cannot be in top-level. Should go to pkgs/development/python-modules/qscintilla/.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops! editor goof

# Build processes depend on the built libraries. Extend
# LD_LIBRARY_PATH as required.
preConfigure = ''
export LD_LIBRARY_PATH=`pwd`/build/output/lib:${stdenv.lib.makeLibraryPath [ openssl ]}$LD_LIBRARY_PATH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would not adding -DCMAKE_SKIP_BUILD_RPATH=OFF to cmakeFlags remove the need for this hack this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. That was from the previous QGIS version. I'll try that option and see.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently the preConfigure section is not required any more.

preBuild = ''
export LD_LIBRARY_PATH=`pwd`/output/lib:${stdenv.lib.makeLibraryPath [ openssl ]}:$LD_LIBRARY_PATH
'';
nativeBuildInputs = [ cmake ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add ninja when using cmake, it is usually faster than make.

Copy link
Member

@FRidh FRidh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not yet replace 2.8 by 3.0 because 3.0 is not yet feature complete. Instead, add 3.0 next to 2.8.


nativeBuildInputs = [ cmake makeWrapper ];
pythonBuildInputs = [ python3Packages.qscintilla python3Packages.gdal ] ++
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go into let ... in expression.

wrapProgram $out/bin/qgis \
--prefix PATH : $program_PATH \
--prefix PYTHONPATH : $program_PYTHONPATH \
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ openssl ]}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be patched instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably not necessary anymore. ldd $(nix-build -A qgis)/bin/.qgis-wrapped | grep openssl shows it is linked correctly.


wrapProgram $out/bin/qgis \
--prefix PATH : $program_PATH \
--prefix PYTHONPATH : $program_PYTHONPATH \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No prefixing, but setting so PYTHONPATH cannot leak inside.

@@ -17335,7 +17335,11 @@ with pkgs;

qemu-riscv = callPackage ../applications/virtualization/qemu/riscv.nix {};

qgis = callPackage ../applications/gis/qgis {};
qgis-unwrapped = libsForQt5.callPackage ../applications/gis/qgis {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why expose the unwrapped version? Is it used somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exposing the unwrapped version in these cases is easiest way (IMO) to enable an overlay changing the source of the application. EG:

@@ -10065,6 +10065,27 @@ in {
};
};

OWSLib = buildPythonPackage rec {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are moving Python expressions out of pkgs/top-level/python-packages.nix into pkgs/development/python-modules/<module>/default.nix.

Please move the expression there, and call it from pkgs/top-level/python-packages.nix using callPackage ../development/python-modules/<package> { };.

OWSLib = buildPythonPackage rec {
pname = "OWSLib";
version = "0.16.0";
name = "${pname}-${version}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name attribute is added by buildPython* and should therefore be removed.

@jtojnar
Copy link
Contributor

jtojnar commented Mar 29, 2018

We should not yet replace 2.8 by 3.0 because 3.0 is not yet feature complete.

Do you have a source for that? I only found

This is the first release in the 3.x series. It comes with tons of new features and under-the-hood updates. As such, we do not expect it to be as reliable as the 2.18 LTR just yet.

https://qgis.org/en/site/forusers/visualchangelog30/index.html

@FRidh
Copy link
Member

FRidh commented Mar 29, 2018

Its actually the plugins I meant to refer to. Plugins written in 2 are not compatible with 3. As they are a major feature of QGIS we should not be dropping 2 yet. Before 18.09 we can revisit this choice.

@coreyoconnor
Copy link
Contributor Author

That explains the mixed messaging I've seen online. The version number and some messaging indicates the QGIS 3 is released. Other messaging (EG: loading screen) states "early adopter".

I just figured it was inconsistency haha. The plugin situation explains that. I'll re-add the 2 derivation.

This uses the recommended configuration for python 3 and qt5. The config
used for python 2 and qt 4 is unchanged from before.
@coreyoconnor coreyoconnor force-pushed the qgis-3.0.1 branch 5 times, most recently from 0294449 to 5e3ce30 Compare March 30, 2018 00:56
@coreyoconnor
Copy link
Contributor Author

I re-added QGIS 2.18 as well as resolved the noted issues. Other changes with latest commits:

  • Qscintilla is 2.9 not 2.10 as in the original commits. 2.10 has a different library naming convention (_qtN suffix) which would change the interface for any existing qscintilla dependents. I don't know if that would matter so I'll defer the upgrade till later.
  • partitioned the python package changes into separate commits.

Copy link
Member

@FRidh FRidh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the wrapper needed? Can't this be done in the installPhase or fixupPhase?

Of course it is more convenient when designing the wrappers when not needing to rebuild the whole thing.

with lib;
let
pythonBuildInputs = with python3Packages;
[ python3Packages.qscintilla gdal jinja2 numpy psycopg2 pygments pyqt5 sip OWSLib six ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repeating python3Packages

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a repeat. The "with" does not cause the "qscintilla" to be shadowed. Without the extra python3Packages the "qscintilla" passed is not the one in python3Packages but the C++ library one.

buildInputs = [ dateutil pep8 pillow pyproj pytz requests tox ];
checkInputs = [ pytest pytestcov ];

doCheck = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the tests disabled? Include a comment in the expression explaining why the tests are disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No tests run and the build fails because no test run. I figured this was a bug in the python build infrastructure.

sha256 = "0m05225g1sqd2i8r2riaan33953hfni9wjq7n225snhl7klsb5gc";
};

buildInputs = [ dateutil pep8 pillow pyproj pytz requests tox ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cehckInputs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already resolved. Not sure why this diff is showing up for you.

@coreyoconnor
Copy link
Contributor Author

The wrapper is required to enable extension of the qgis python environment by users without requiring a rebuild of the full application. EG: to add additional deps for plugins for instance.

let
# the python packages that should be included in the PYTHONPATH
pythonInputs = with python3Packages;
qgis3-unwrapped.pythonBuildInputs ++ [ chardet dateutil pyyaml pytz requests urllib3 ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should these few be included in the wrapper, but not in the build? Are they needed for specific plugins?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to build. The reference errors these resolved only showed up at runtime.
I would expect these are transitive dependencies for packages missing respective propagatedBuildInputs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not hard dependencies otherwise the builds of the dependents would fail. Either upstream has forgotten to list their full dependencies, or they require "extras" of certain packages.
https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies

@coreyoconnor
Copy link
Contributor Author

Amended to resolve current CRs.

--prefix PATH : $program_PATH \
--set PYTHONPATH $program_PYTHONPATH

# desktop link
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following seems irrelevant for the wrapper and thus better placed in the original derivation. Or am I missing something?

@coreyoconnor
Copy link
Contributor Author

Times up! no further changes will be submitted.

@mpickering
Copy link
Contributor

This looks like a great start. I was blocked on this as some dependencies were not building for darwin. If they are resolved I can pick it up.

@das-g
Copy link
Member

das-g commented May 11, 2018

I successfully built QGIS 3 from this branch on NixOS 18.03.

How do we proceed? Shall I attempt to resolve the merge conflicts with master?

Times up! no further changes will be submitted.

What does that mean? Was your effort on this time-boxed @coreyoconnor or are you referring to NixOS release 18.03?

@lsix lsix mentioned this pull request May 29, 2018
8 tasks
@das-g
Copy link
Member

das-g commented Jun 24, 2018

QGIS 3.2 Bonn has been released. Time to revive this PR?

@coreyoconnor
Copy link
Contributor Author

Hi! The time I had for this original PR ran out a while ago. I will not have a chance for a few weeks (sadly) to really dig into this again. Anyone should feel free to take the changes thus far and carry on, of course.

I do have a separate branch with these changes rebased against HEAD. Might be able to get this updated accordingly but besides that... a few weeks it is.

@coreyoconnor
Copy link
Contributor Author

Clearing old PRs.

@das-g
Copy link
Member

das-g commented Mar 2, 2019

New PR for QGIS 3.4.5 (=the new LTR version and now currently only LTR version): #56486

@das-g das-g mentioned this pull request Mar 2, 2019
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants