3
0
Fork 0
forked from mirrors/nixpkgs
Commit graph

147 commits

Author SHA1 Message Date
Nikolay Amiantov 895f51222e buildPythonPackage: add installFlags 2016-02-21 12:20:51 +01:00
Vladimír Čunát e4ab8aee62 add ensureNewerSourcesHook and apply to all python
Fixes #12663: problems in python stuff due to old timestamps in sources.
- Files in sources older than a certain year are set to that year.
- Applied with 1980 for all python packages due to the way it often uses zip.
2016-02-03 10:21:16 +01:00
Domen Kožar 07049a7edf python generic builder: fix typos 2016-01-27 13:11:20 +01:00
Domen Kožar 7a3b518d62 buildPythonPackage: fix a regression #11303 2015-11-27 11:44:34 +01:00
Domen Kožar 0c772699ba buildPythonPackage: write some comments 2015-11-26 17:31:10 +01:00
Domen Kožar cf5984e4bf buildPythonPackage: fix support for pypy 2015-11-23 17:47:35 +01:00
Rok Garbas d82f55aead pythonPackages: shellHook of buildPythonPackages needs tmp_path to have lib/pythonX.Y/site-packages folder 2015-11-23 17:43:32 +01:00
Domen Kožar 90f97c125d buildPythonPackage: use pip for development also 2015-11-21 22:17:04 +01:00
Domen Kožar c6c58dc92d release-python.nix: automatically detect buildPythonPackage 2015-11-21 21:44:12 +01:00
Domen Kožar 9bf99a5a4d buildPythonPackage: don't do build_ext if not needed 2015-11-21 21:44:12 +01:00
Domen Kožar 127a20f8da buildPythonPackage: sadly, checkPhase is too often installPhase in python 2015-11-21 21:44:12 +01:00
Domen Kožar 6ba529277a buildPythonPackage: catch_conflicts should ignore pip 2015-11-21 21:44:12 +01:00
Domen Kožar 1029db9024 buildPythonPackage: fix do_conflict.py on python 3 2015-11-21 21:44:12 +01:00
Domen Kožar a912c45ee2 buildPythonPackage: get rid of setupPyInstallFlags since there is no such thing 2015-11-21 21:44:12 +01:00
Domen Kožar 42acb5dc55 buildPythonPackage: fix pypy 2015-11-21 21:44:12 +01:00
Domen Kožar f900231042 buildPythonPackage: fail if two packages with the same name are in closure 2015-11-21 21:44:12 +01:00
Domen Kožar f3092d6446 buildPythonPackage: use a separate file to fire off setup.py 2015-11-21 21:44:12 +01:00
Domen Kožar 960274fc7c wrapPython: use $out/bin also for $PATH (fixes pyramid pserve --reload) 2015-11-21 21:44:12 +01:00
Domen Kožar a2a6f60b5a WIP: buildPythonPackages now uses wheels internally 2015-11-21 21:44:12 +01:00
Domen Kožar b666ac3e9f Revert "python: skip build at install phase"
This reverts commit d34f5b6570.

PIL and NumPy don't like this change and I'd rather spend time on
bringing wheels to Nix than fixing old infrastructure.
2015-11-15 13:50:04 +01:00
Domen Kožar 5a16c0e6e4 buildPythonPackage: clean up shellHook 2015-11-15 13:50:04 +01:00
Domen Kožar d34f5b6570 python: skip build at install phase
"python setup.py install" will also run "python setup.py build"
which we've already done in buildPhase.
2015-11-04 11:40:09 +01:00
Domen Kožar 0509252e28 python: don't pass disabled to derivation 2015-10-30 11:31:19 +01:00
Vladimír Čunát 8f33b8cc93 mass rewrite of find parameters to cross-platform style
Fixes #9044, close #9667. Thanks to @taku0 for suggesting this solution.
Now we have no modes starting with `/` or `+`.

Rewrite the `-perm` parameters of find:
 - completely safe: rewrite `/0100` and `+100` to `-0100`,
 - slightly semantics-changing: rewrite `+111` to `-0100`.
I cross-verified the `find` manual pages for Linux, Darwin, FreeBSD.
2015-09-06 10:26:30 +02:00
Vladimír Čunát 862900e42e mass-replace deprecated usage of find -perm (Fixes #9044)
sed 's|-perm +0|-perm /0|g'
It's a mass-rebuild due to usage in stdenv's default setup hooks.
2015-07-30 10:30:17 +02:00
aszlig b028c14256
python-wrapper: Fix variable name for sed expr.
Regression introduced by 5f55788531.

The commit not only changes documentation, but also changed a few
variable names. One of them is $i which now is $f and it contains the
name of the file to wrap.

This was accidentally found by @Profpatsch (thanks!) who found himself
getting the basename of the last patch file to end up in sys.argv[0].
The reason for this is that $i is used in the for loop of the generic
patchPhase and thus is reused later when the Python file is to be
wrapped.

I have also added a small comment noting about this, to be sure that
this won't accidentally occur the next time someone changes variable
names.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2015-07-07 18:25:10 +02:00
Allen Nelson 6bb2e47abf using makeWrapperArgs instead of setEnvVars 2015-05-24 10:21:33 -05:00
Allen Nelson bf1a16bbea removing superfluous lets 2015-05-24 10:21:33 -05:00
Allen Nelson 06ff4af597 Adding documentation to wrap.sh, added ability to retain any desired environment variables. 2015-05-24 10:21:33 -05:00
Allen Nelson 5f55788531 adding docs to python wrap.sh 2015-05-24 04:55:24 -05:00
aszlig 311aa5d8d9
python-wrapper: Handle strings at the beginning.
This should fix #7366 for now, but using the (IMHO) pragmatic approach
of extending the sed expression to recognize strings.

However, this approach is obviously not parsing the full AST, nor does
it wrap Python itself (as pointed out by @spwhitt in #7366) but tries to
match Python strings as best as possible without getting TOO unreadable.

We also use a little bit of Nix to help generating the SED expression,
because doing the whole quote matching block over and over again would
be quite repetitious and error-prone to change. The reason why I'm using
imap here is that we need to have unique labels to avoid jumping into
the wrong branch.

So the new expression is not only able to match continous regions of
triple-quoted strings, but also regions with only one quote character
(even with escaped inner quotes) and empty strings.

However, what it doesn't correctly recognize is something like this:

"string1" "string2" "multi
line
string"

Which is very unlikely that we'll find something like this in the wild.
Of course, we could handle it as well, but it would mean that we need to
substitute the current line into hold space until we're finished parsing
the strings, branch off to another label where we match multiline
strings of all sorts and swap hold/pattern space and finally print the
result. So to summarize: The SED expression would be 3 to 4 times bigger
than now and we gain very little from that.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2015-04-14 07:13:15 +02:00
Domen Kožar c6512f7df3 buildPythonPackage: propagate setuptools 2015-04-12 21:15:36 -04:00
Domen Kožar 0fd3db4ba1 fix #6548 2015-03-07 22:31:40 +01:00
Domen Kožar b653e3f661 Revert "python-generic: set meta.broken for disabled packages instead of raising an error during evaluation"
This reverts commit 79a5fec9c0.

meta.broken uses 'throw' under the hood so it can not improve the
current situation. Reverting to previous behaviour gives us correct
error message to the user indicating that interpreter is not supported.

Correcting Hydra output is out of scope of Python packaging.
2015-02-25 09:23:31 +01:00
Peter Simons 27b57469e8 python-generic: cosmetic 2015-02-13 10:37:46 +01:00
Peter Simons 79a5fec9c0 python-generic: set meta.broken for disabled packages instead of raising an error during evaluation
We have tons of evaluation errors on Hydra because it tries to build
known broken packages. Re-using meta.broken makes sure these packages
aren't evaluated in the first place.
2015-02-12 20:07:56 +01:00
Domen Kožar 9a33fbb52d python: don't propagate installed packages into userenv, refs #4949
Propagation is not needed anymore, as we have more powerful apis today
than this dirty hack. See nix-shell tool and python.buildEnv function
in nixpkgs manual.
2015-01-17 14:19:29 +01:00
Domen Kožar ab423e6367 buildPythonPackage: add python to propagatedBuildInputs
Doing:

$ nix-shell -p pythonPackage.pyramid

now also sets $PYTHONPATH. Previously you'd have to do:

$ nix-shell -p pythonPackage.pyramid python
2014-11-13 21:04:13 +01:00
Rok Garbas 602f7e5aa4 python: collision in names when developing 2 and more python packages with nix
when you run nix-shell 2 times at the same time of project (but different
branches) you get collision in names inside /tmp folder. i solved this by
hashing current path of developing folder and using that as indentifier while
still keeping name at the end.

diff --git a/pkgs/development/python-modules/generic/default.nix
b/pkgs/development/python-modules/generic/default.nix index 4c9c53a..6ec7934
100644 --- a/pkgs/development/python-modules/generic/default.nix +++
b/pkgs/development/python-modules/generic/default.nix @@ -161,11 +161,12 @@ if
disabled then throw "${name} not supported for interpreter ${python.executabl

   shellHook = attrs.shellHook or ''
     if test -e setup.py; then
-       mkdir -p /tmp/$name/lib/${python.libPrefix}/site-packages
+       tmp_path=/tmp/`pwd | md5sum | cut -f 1 -d " "`-$name
+       mkdir -p $tmp_path/lib/${python.libPrefix}/site-packages
        ${preShellHook}
-       export PATH="/tmp/$name/bin:$PATH"
-       export PYTHONPATH="/tmp/$name/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
-       ${python}/bin/${python.executable} setup.py develop --prefix /tmp/$name
+       export PATH="$tmp_path/bin:$PATH"
+       export PYTHONPATH="$tmp_path/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
+       ${python}/bin/${python.executable} setup.py develop --prefix $tmp_path
        ${postShellHook}
     fi
   '';
2014-09-19 14:23:45 +02:00
Michael Raskin 76f4eb5f93 Revert "python-wrapper: fix wrapped argv[0] w/o sed, maybe"
This reverts commit a6dd9bd0cb.
2014-09-02 20:45:41 +04:00
tv@shackspace.de a6dd9bd0cb python-wrapper: fix wrapped argv[0] w/o sed, maybe 2014-09-02 01:31:49 +04:00
Domen Kožar 62345fee55 python: provide better message if python interpreter is not supported 2014-08-27 15:53:15 +02:00
Domen Kožar 47673e43c9 buildPythonPackage: introduce "disabled" argument
Useful to disable the package for specific python versions.

Typically usage: disable = isPy3k;
2014-08-24 16:02:57 +02:00
aszlig 21a2f99dd3
python-wrapper: Fix handling of line breaks.
Not really critical for anything we have in <nixpkgs> I guess, but
skipping lines three times really was a workaround and we're better off
just appending the lines ending with backslash to the pattern space so
we can accumulate all the crap until the last line of crap (crap, that
is "broken lines").

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-07-29 06:53:17 +02:00
aszlig ff15c31c37
python-wrapper: Fix handling __future__ imports.
The bazaar package is still broken even with 5f01cc7, because __future__
imports need to be the first imports before anything else. So this time
I'm going to make the sed expression with explicit branching so we can
properly match all the occasions we want to skip and insert the line
modifying sys.argv[0] only _once_ and leave the command block after
that one substitution. So no ugly swaps between hold and pattern space.

The label which is resonsible for not escaping the command block is "r"
and we jump to it as long as we need to skip something from the start of
the file.

While at it, I'm not only skipping every line with __future__ in it but
also backslashes at the end of the line, so for example:

```python
from __future__ import shiny_feature1, \
                       shiny_feature2, \
                       shiny_feature3
```

... will now be properly skipped as well.

Tested against bazaar and nixops.

Thanks to @edolstra for reporting this.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-07-29 06:40:39 +02:00
aszlig 5f01cc70d3
python-wrapper: Fix fixup for wrapped argv[0].
Fixes issues introduced by 24ef871e6a.

The problem here is that "import sys; sys.argv[0] = ..." is just
appended after the first "#!", which in turn breaks things such as
encoding specifications. A second problem - although not very common -
is when there's another #! within the script.

This should take care of both cases.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-07-28 04:18:21 +02:00
Christian Theune 24ef871e6a python: fix argv[0] for wrapped console_scripts.
Previously programs would see '.<program>-wrapped' as their program name. This is a workaround
but should be reasonably safe and reliable.
2014-07-27 13:23:15 +02:00
Domen Kožar 0d71d2b631 fixes #2926 2014-06-15 16:05:18 +02:00
Jussi Maki 75cb485718 ansible: conventions, fix module execution 2014-05-21 14:46:37 +02:00
Domen Kožar 296dd89030 buildPythonPackage: don't return on shellHook
Entering environment might not always be the desired effect.
2014-04-07 00:43:50 +02:00