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

~/.config/hub does not work with popen on python #1164

Closed
strongwinderic opened this issue Apr 20, 2016 · 2 comments
Closed

~/.config/hub does not work with popen on python #1164

strongwinderic opened this issue Apr 20, 2016 · 2 comments

Comments

@strongwinderic
Copy link

I am using a toll called weblate, which is using hub to work with the repository.

So, when I first give a command on command line, it asks for my username ans password, and creates a token on ~/.config/hub, as expected. Any other thing I do on command line, it doesn't require my user name or password again.

But, weblate uses popen, on a python script, to call gub. something like this:

        process = subprocess.Popen(
            ['hub', 'fork'],
            cwd='path/to/my/repo',
            env=get_clean_env({'GIT_SSH': ssh_file(SSH_WRAPPER)}),
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,            
        )
        output, output_err = process.communicate()
        retcode = process.poll()

So, when it tries to execute the command, it doesn't find the ~/.config/hub file, because there is no home directory for process, right?

Also, I see there is a environment variable that can be defined, which is HUB_CONFIG, to point to the hub configuration file. But again, there is no way to set a environment variable for a process, right?

Is there a way to define a hub configuration file when running from a popen process? Maybe a global config file which hub will look if it doesn't find a ~/.config/hub file?

Thanks in advance!

@mislav
Copy link
Owner

mislav commented May 3, 2016

Sorry for late reply. I'm not sure what you're asking. You seem to be using get_clean_env and setting GIT_SSH environment variable manually. Can't you use the same approach to set either HOME or HUB_CONFIG value too? Anyway, I'm not too familiar with Popen on python, but this is definitely possible. It's also out of scope for this project, which doesn't deal with python at all, so it's your responsibility to perform due diligence. 😉

@mislav mislav closed this as completed May 3, 2016
@strongwinderic
Copy link
Author

Hi @mislav! Thank you for your response! I'll try the approach you suggested! Thank you so much!

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

No branches or pull requests

2 participants