1

I have a git repository I've cloned and I've run the setup.py that installs the package. I have enough experience that I know how to insert ipdb.set_trace() into lines of code where I want to start debugging. I have not yet though understood how to run the cloned code in such a way that it's not being run form the binaries created by the setup.py and as I understand it, then compiled and untouchable.

Can someone illuminate as to how to execute a python package in this way?

numb3rs1x
  • 4,673
  • 5
  • 31
  • 44

1 Answers1

0

Just the general course of actions.

  1. I'm on Ubuntu 13.10 and inside virtualenv

    virtualenv salt-test --system-site-packages
    

    We need --system-site-packages due to some bugs after installation of M2Crypto inside virtualenv

  2. Prerequsites:

    apt-get install swig libssl-dev
    
  3. git clone https://github.com/saltstack/salt.git

  4. cd salt
  5. pip install -r requirements.txt
  6. export PYTHONPATH=$PYTHONPATH:/path/to/salt
  7. Now we can run master daemon: ./scripts/salt-master -l debug

You'll see a lot of output and it would hint you what you need to create to run master properly.

NB: After installation I have to activated virtualenv under root to start master

Community
  • 1
  • 1
twil
  • 6,032
  • 1
  • 30
  • 28
  • Is it standard to have a scripts directory containing what gets made into the binaries when setup.py is run? – numb3rs1x Nov 25 '13 at 16:10
  • I don't understand your question. There are helper scripts/programms inside scripts folder. It may contain just anything. Try opening `scripts/salt-master` with text editor and you'll see python code. – twil Nov 25 '13 at 16:19
  • What I'm asking is can I apply this process to other python programs? Is it standard in python to have a scripts directory containing what becomes the commands one can run after setup.py is executed? I'm trying to understand what places the commands after setup.py is run, and if there's a standard practice in python. – numb3rs1x Nov 25 '13 at 17:51
  • Well, yes but not to all of them. If python package needs to be build it could be archived by calling `python setup.py build`. On the other hand there might not be `requirements.txt`. Sometimes `setup.py` scripts could rather.. mad at first sight. So basicaly you need just two things: satisfy requirements for you package and build python modules. After that you can add your package to `PYTHONPATH` and use it. – twil Nov 25 '13 at 19:57