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

Make it so that the nel script can be run from anywhere. #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johann-petrak
Copy link

Small addition to the nel script that will find the actual location of the script directory and add that location to the PYTHONPATH before running python. That way, the nel script (or a symbolic link) can put in the PATH or the script can be run by specifying the full path like so /where/the/script/is/installed/nel .

@benhachey
Copy link
Contributor

[cc @wejradford, @jnothman]

Hi @johann-petrak.

Thanks for this. It's also possible to install using pip, e.g.:

virtualenv ve
. ve/bin/activate
pip install git+git://github.com/wikilinks/neleval.git#egg=NEL

After which you can use the neleval command anywhere, e.g.:

neleval -h

Does it make sense to have both options?

@jnothman
Copy link
Member

I agree with @benhachey. We should rather document the pip install app, if it's not already.

@johann-petrak
Copy link
Author

I do not think the addition to the shell script interferes with anything else or does any harm but it makes it possible to just clone the repository and use the scripts right away. The install procedure you pointed out may need additional packages to get installed or require root priviledges (so people may need to beg their system administrators to install something first) or is otherwise not immediately obvious to users who are not familiar with python, so I thought just have the capability to have the main script work out of the box from anywhere would be a good thing. I routinely include that little codeblock in practically all my bash scripts because it is quite useful in general to be able to run a bash script from anywhere.

@jnothman
Copy link
Member

Well, I'm not entirely convinced (there are dependencies to install anyway; root is not required if we recommend python setup.py install --user or a virtualenv).

As for the codeblock you use in all your scripts, why do you not use readlink?

@jnothman
Copy link
Member

Perhaps, given that we have the launcher script already, we might consider this addition...

@johann-petrak
Copy link
Author

I do not feels strongly about this getting added, I am just sharing it in case you may find it useful and I pointed out why I think it could be useful :)
As to readlink, TBH I cannot remember exactly but I think it is not available on all platforms (I think it is POSIX only) and there may have been other issues.
Even if my method fails, the worst thing that could happen, I think, is that it puts a directory which is not the correct directory into the PYTHONPATH, which will add to what gets put on sys.path anyway, so I cannot see a situation how this could fail in a situation where the original script works.

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.

3 participants