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
gnaf-loader: init at 2018-09-10 #46139
Conversation
a9e5af4
to
f426d11
Compare
f426d11
to
0932856
Compare
So I have made it work as imports. However I had to do some funny things as makeWrapper doesn't have an option to set the interpreter of the executable it is wrapping. Furthermore the source file isn't even set to have the executable permission. While these things could be fixed upstream, I'm sure I'll deal with more of these sorts of things since I'm packaging a lot of scientific stuff and they are not always standards. |
@FRidh Could you have a look? |
One other thing, this script outputs a log file usually placed in the same location as the script. I changed that so it outputs that script to the current directory. I could also point it to |
0932856
to
2158caa
Compare
2158caa
to
8ee2cff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend putting the modules in ${python3.sitePackages}
, especially because psma
is used as a module.
dontBuild = true; | ||
|
||
installPhase = '' | ||
mkdir -p $out/bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow FHS inside $out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean here.
chmod u+x,g+x,o+x $out/load-gnaf.py | ||
makeWrapper \ | ||
$out/load-gnaf.py \ | ||
$out/bin/load-gnaf.py \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
executables should not have an extension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even when the source script is just load-gnaf.py
? Are you suggesting we make the wrapper load-gnaf
?
makeWrapper \ | ||
$out/load-gnaf.py \ | ||
$out/bin/load-gnaf.py \ | ||
--set PYTHONPATH "$PYTHONPATH" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the scripts have a shebang? Add python3.withPackages(ps: with ps; [ psycopg2 ]
to buildInputs
and patchShebangs
will handle it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't have a shebang, that's why I added the shebang in manually with sed
.
The psma is just another python module in the same relative directory. What do you mean by putting it into site-packages? The source repo doesn't use setup.py or anything. |
No, it indeed doesn't, and they don't have to. However, if one would take your expression, and install it in a profile, they end up with scripts in the root of their profile, instead of under |
The problem is that the script relies on relative imports and relative paths to the SQL scripts. I'm not sure how to do that with buildPythonApplication or buildPythonPackage. |
You don't need to use |
So I can do this these things. Use: Then inside the
The We still need something in
Or maybe instead:
|
(triage) @CMCDragonkai I personally prefer your first option, though I haven't checked whether it actually corresponded to @FRidh's request. The advantage of it over your second option is that you avoid loading one useless file in memory, a priori. Actually, I think you may even get rid of the |
Are there any updates on this pull request, please? |
Feel free to take over the PR @mmahut, I'm not working on this atm. |
Ok, going to close it for now, if anyone is interesting in taking over, feel free to reopen this. |
Motivation for this change
I need some help with this. It's a python script that isn't a Python package. I thought I can use
stdenv.mkDerivation
but how do I get a python module dependency into it? It relies onpsycopg2
!gnaf-loader is a script that loads the GNAF data into a PostgreSQL database. The GNAF database is a database of all postable addresses in Australia and it's used by a lot of GIS applications targeting Australia.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)