[Nix-dev] pybitmessage python help

Rok Garbas rok at garbas.si
Wed Apr 29 10:05:24 CEST 2015


Quoting Tomas Hlavaty (2015-04-28 23:28:00)
> Hi,
> 
> I'm writing a nix expression for PyBitMessage:
> 
> {stdenv, fetchgit, python27, qt4, pyqt4, sqlite, openssl, mpg123}:
> 
> stdenv.mkDerivation rec {
>   name = "pybitmessage-v0.4.4";
> 
>   src = fetchgit {
>     url = "https://github.com/Bitmessage/PyBitmessage.git";
>     rev = "713ed89467b9c766cb22df0cc51415a93fd1801d";
>     sha256 = "0d70xj0bap7dwh1lj8fj0k0hwhfnzgz2g5jlh2sgqpaqpd74q1dq";
>   };
> 
>   #pythonPath = [pyqt4];
> 
>   #buildInputs = [python27 pythonPackages.wrapPython];
> 
>   propagatedBuildInputs = [qt4 pyqt4 sqlite openssl mpg123];
> 
>   installPhase = ''
>     mkdir -p $out/share/pybitmessage
>     cp -r src/* $out/share/pybitmessage/
>     mkdir -p $out/bin
>     ln -s $out/share/pybitmessage/bitmessagemain.py $out/bin/pybitmessage
>   '';
> 
>   meta = with stdenv.lib; { 
>     homepage = https://bitmessage.org;
>     description = "Bitmessage is a P2P communications protocol";
>     license = licenses.mit;
>   };
> }
> 
> However, python cannot find pyqt4:
> 
> % pybitmessage 
> pybitmessage 
> Loading existing config files from /home/tomas/.config/PyBitmessage/
> 2015-04-28 23:23:44,401 - DEBUG - Database file already exists.
> 2015-04-28 23:23:44,656 - DEBUG - Loaded 0 objects from disk into the objectProcessorQueue.
> 2015-04-28 23:23:44,657 - DEBUG - reloading keys from keys.dat file
> 2015-04-28 23:23:44,766 - DEBUG - reloading subscriptions...
> An Exception occurred within isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections: invalid version number '#1 SMP PREEMPT Wed Apr 8 14:10:00 CEST 2015'
> PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download   or by searching Google for 'PyQt Download'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon
> ('Error message:', ImportError('No module named PyQt4',))
> You can also run PyBitmessage with the new curses interface by providing
> '-c' as a commandline argument.
> 
> 
> I tried searching nixpkgs and trying things but have not managed to
> figure it out.  Does somebody have an idea, how to get it to work?
> 
> Thanks a lot,
> 

Hi Tomas,

you would need to wrap you binaries ($out/bin/pybitmessage) with PYTHONPATH in
your installPhase, eg:

    wrapProgram $out/bin/pybitmessage --prefix PYTHONPATH : "$PYTHONPATH"

you can look for more examples how to package python in

    pkgs/top-level/python-packages.nix (in nixpkgs ofcourse)



--
Rok Garbas - http://www.garbas.si
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: signature
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150429/34418dca/attachment.bin 


More information about the nix-dev mailing list