-
Notifications
You must be signed in to change notification settings - Fork 143
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
svn subprocess environment customization #75
Conversation
@@ -22,12 +22,32 @@ def __init__(self, message): | |||
|
|||
|
|||
class CommonClient(object): | |||
"""Subversion client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of the documentation-level commenting. It's not clear what documentation convention you are using and almost nothing else is has such comprehensive documentation-level commenting (ergo, it should be done everywhere, not just in one place).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also encourages people to use CommonClient
directly (which I've seen before), which is not correct.
def __init__(self, url_or_path, type_, *args, **kwargs): | ||
self.__url_or_path = url_or_path | ||
self.__username = kwargs.pop('username', None) | ||
self.__password = kwargs.pop('password', None) | ||
self.__svn_filepath = kwargs.pop('svn_filepath', 'svn') | ||
self.__trust_cert = kwargs.pop('trust_cert', None) | ||
self._env = kwargs.get('env', {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we don't use the convention of single-underscore prefixed variables, certainly not in all of the other parameters here. You should carry the convention of the surrounding code. Rename _env
to __env
.
1 similar comment
@@ -73,7 +54,7 @@ def run_command(self, subcommand, args, success_code=0, | |||
|
|||
environment_variables = os.environ.copy() | |||
environment_variables['LANG'] = 'en_US.UTF-8' | |||
environment_variables.update(self._env) | |||
environment_variables.update(self.__env) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do this before the "LANG" assignment and you have a deal. Since that's an explicit parameter and the environment collection just provides support for something that is general in nature, the latter can't be allowed to potentially overwrite the former. Thanks.
Here I've added possibility to pass custom set of environment variables to underlying
svn
command. Sometimes it's desirable to customize environment at use time but not desirable or possible to change global environment. For example my use case is settingSVN_SSH
to use login not matching current user and ssh identity located at non-standard path.