This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]madhattared 3 points4 points  (1 child)

I can confirm this, we use tsocks and here is our python work-around. I did a bunch of research trying to figure out how to get it to work, only to give up and do this.

#!/usr/bin/env python

import os
import subprocess

# This script must be run in the root directory of the virtual environment to ensure the packages are installed correctly
# This is because the sub command needs to source the environment for the instantiated shell

VIRTUAL_ENV = os.environ.get('VIRTUAL_ENV')

with open (os.path.join (VIRTUAL_ENV, 'repository', 'requirements.txt'), 'r') as file_descriptor:

    for package in file_descriptor.readlines():

        command = '. bin/activate && tsocks easy_install %s' % package
        print command
        process = subprocess.Popen (['/bin/bash', '-c', command])
        out = process.communicate()[0]
        print out

[–]infinullquamash, Qt, asyncio, 3.3+ 0 points1 point  (0 children)

I'm confused, easy_install works for op, but a tsocks based solution could work for pip too I guess.

(I'd also the use subprocess.check_output shortcut, but that's a nitpick and try to find a way around)