0

so the answer to this question seems to be in the /usr/local/bin folder, which is fine for a single script file but my program has multiple .py files and folders containing HTML files which the program relies on like so:

program
    -templates
        file1.html
        file2.html
    script.py
    class.py
    another_class.py

How would I go about setting this up globally under linux?

twigg
  • 3,753
  • 13
  • 54
  • 96
  • Provide a `setup.py` that installs your package and any scripts that it provides. – jonrsharpe Jun 23 '15 at 14:55
  • @jonrsharpe how is this a duplicate of that answer? I'm not asking how to make setup.py file – twigg Jun 23 '15 at 15:06
  • But you want to know how to install your script globally and access the functionality in your package, which *can be achieved using a `setup.py`*. If that question doesn't answer yours, please edit to clarify what you still need to know. – jonrsharpe Jun 23 '15 at 15:07

1 Answers1

1

You could put your program to /usr/loca/myprog and then create a symlink from /usr/local/myprog/scrip.py to /usr/loca/bin. This assumes it is script.py you want to be available as an executable globally. Alternatively, create a shell script /usr/local/bin/myprog.sh that invokes your python script.

#!/bin/sh
python /usr/local/myprog/script.py

Of course this is not really a clean solution. The suggestion in the comments to create a distutils package based on setup.py file is much better.

Bernhard
  • 8,583
  • 4
  • 41
  • 42