1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-27 08:01:14 +00:00
Commit graph

125 commits

Author SHA1 Message Date
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
Eelco Dolstra 1fe2a68224 quodlibet: Fix evaluation
http://hydra.nixos.org/build/9400950
2014-03-10 14:51:05 +01:00
Jaka Hudoklin 0558c87288 buildPythonPackage: add shell hook for instant development 2014-03-10 11:28:47 +01:00
Jaka Hudoklin f0f2125620 pythonPackages: auto add unzip to buildInputs if pkg has zip suffix 2014-03-08 23:29:15 +01:00
Domen Kozar 649e7d6fdb python wrap.sh: wrap pypy and python shebangs 2014-03-07 16:50:46 +01:00
Domen Kozar fedd018d93 fix pypy and pypyPackages 2014-03-07 14:34:06 +01:00
Domen Kožar f1db57f1fe buildPythonPackage: fix more borken packages 2014-02-21 18:29:57 +01:00
Domen Kožar 567e67f05f bash doesn't allow comments between multiline statements 2014-02-20 01:19:16 +01:00
Domen Kožar fa98edf2b1 fix eval 2014-02-20 01:19:16 +01:00
Domen Kožar b1ffb9ede4 buildPythonPackage: Add --old-and-unmanageable flag to install command and add more docs.
For explanation see inline comments.
2014-02-20 01:19:16 +01:00
Domen Kožar c80feaf542 document setuptools monkeypatching and DETERMINISTIC_BUILD=1 2014-02-20 01:19:16 +01:00
Domen Kožar 21ada5b105 garden 2014-02-20 01:19:16 +01:00
Domen Kožar bf5d6fb9b1 Refactor buildPythonPackage to modularize building process.
Before we used `easy_install` command to handle installation
in one shot, now this is split into two phases:

 - buildPhase: python setup.py build
 - installPhase: python setup.py install

Each of those commands have the ability to pass extra
parameters through buildPythonPackage parameters as
`setupPyInstallFlags` and `setupPyBuildFlags`.

Phases now correctly execute post/pre hooks.

In configurePhase we inject setuptools dependency before distutils
is imported to apply monkeypatching by setuptools that is needed
for special features to apply.

We don't have to reorder default phases anymore, as test
phase comes after build and that works.

I rewrote offineDistutils into distutils-cfg with a bit cleaner
syntax and ability to specify extraCfg to the config file.

Plone packages are failing and garbas said he will adopt them to
the new functions. The rest of the packages I fixed and these commits
shouldn't break any package (according to my testings) and they introduce
16 new jobs and fix 38 that were broken before.
2014-02-20 01:19:15 +01:00
Domen Kozar 7458f29dc9 don't wrap scripts in EGG-INFO/scripts since they are called from python 2013-07-29 19:31:58 +02:00
Domen Kozar 918e5efb99 recurse into python33 and pypy packages 2013-07-29 14:52:19 +02:00
Domen Kozar 4993f07fee python: include python version when prefixing python packages 2013-07-29 12:09:06 +02:00
Domen Kozar 5ec6cf3756 add python3 support to pythonPackages 2013-07-29 12:09:06 +02:00
Evgeny Egorochkin 09e6ae577b Python: add DETERMINISTIC_BUILD env var. If set, python doesn't write timestamps to pyc files. Tested by
building argparse, compiling from cli, compiling using py_compile.
2013-06-22 09:45:01 +03:00
Eelco Dolstra 0a47a28f1d Merge remote-tracking branch 'origin/master' into stdenv-updates 2013-01-22 23:23:53 +01:00
Florian Friesdorf a865154f62 Add myself as (additional) maintainer to all python packages. 2013-01-21 04:44:25 +01:00
Rickard Nilsson 1886d1db6a Merge remote-tracking branch 'upstream/master' into stdenv-updates 2013-01-20 16:53:21 +01:00
Florian Friesdorf 8f0ea2b4c0 pythonPackages: default to python's maintainers and platforms 2013-01-19 18:32:03 +01:00
Eelco Dolstra 5bb548d2e4 Merge remote-tracking branch 'origin/master' into stdenv-updates 2013-01-17 14:19:14 +01:00