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

firefox syncserver service: fix PYTHONPATH #28188

Merged
merged 1 commit into from
Aug 12, 2017

Conversation

Nadrieril
Copy link
Member

Along with #28187 and #28186, this is enough to make the sync server work again (see #25530).
I have been using the service with two devices for a week now, and as far as I can tell it works well.

  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • 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.

@mention-bot
Copy link

@Nadrieril, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nbp, @fpletz and @wkennington to be potential reviewers.

@@ -124,7 +124,13 @@ in
description = "Firefox Sync Server";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.pythonPackages.pasteScript pkgs.coreutils ];
environment.PYTHONPATH = "${pkgs.pythonPackages.syncserver}/lib/${pkgs.pythonPackages.python.libPrefix}/site-packages";
Copy link
Member

Choose a reason for hiding this comment

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

Why is PYTHONPATH used? I suggest creating a single Python environment.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know what you mean by that. How would I do it ? I'm not very familiar with python+nix

extraLibs = [ pkgs.pythonPackages.syncserver ];
ignoreCollisions = true;
};
in "${penv}/${pkgs.python.sitePackages}/";
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be simpler to add python.withPackages (ps: [ps.syncserver]) to path instead? Not 100% sure if it would work though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh I didn't know about withPackages. How would I use it ? Would ${python.withPackages (ps: [ps.syncserver ps.paster])}/bin/paster work ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually syncserver has a two versions of wsgiproxy in its dependencies, which causes a conflict with python.withPackages

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, paster and syncserver are two separate Python programs. They should not share any PYTHONPATH at all. Therefore, exporting PYTHONPATH is tricky.

Could you try FRidh@9687f59

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, paster needs to find syncserver somehow. I tested your patch, I get "pkg_resources.DistributionNotFound: The 'syncserver' distribution was not found and is required by the application" from paster

Copy link
Member Author

Choose a reason for hiding this comment

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

can't you get rid of ignorecollisions now that you override the dependency ?

Copy link
Member

Choose a reason for hiding this comment

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

Made a mistake there, because we should not ignore collisions
FRidh@938562f

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm, I looked more precisely, and webtest is only a build-time dependency of pyramid... the conflict may be from somewhere else and may be due to a packager mixing build-time and runtime deps

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, webtest is a testing framework, it should never be propagated. But a number of packages do not make the distinction (e.g. https://github.com/mozilla-services/pyramid_hawkauth/blob/master/setup.py)

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the correct fix: #28193

@Nadrieril
Copy link
Member Author

I squashed your commits and pushed. This works on my server.

@FRidh FRidh merged commit c06fb4a into NixOS:master Aug 12, 2017
@Nadrieril Nadrieril deleted the ffsync-fix-pythonpath branch January 1, 2018 19:13
@Nadrieril Nadrieril restored the ffsync-fix-pythonpath branch February 10, 2018 15:20
@Nadrieril Nadrieril deleted the ffsync-fix-pythonpath branch February 10, 2018 15:20
@Nadrieril Nadrieril restored the ffsync-fix-pythonpath branch February 10, 2018 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants