> On 15 Mar 2019, at 22:17, Martin De Kauwe <mdeka...@gmail.com> wrote:
>
> Hi,
>
> I'm trying to write a script that will make a checkout from a svn repo and
> build the result for the user. However, when I attempt to interface with the
> shell it asks the user for their filename and I don't know how to capture
> this with my implementation.
>
> user = "XXX578"
> root="https://trac.nci.org.au/svn/cable"
> repo_name = "CMIP6-MOSRS"
>
> cmd = "svn checkout %s/branches/Users/%s/%s" % (root, user, repo_name)
> p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
> stdout=subprocess.PIPE,
> stderr=subprocess.PIPE)
> error = subprocess.call(cmd, shell=True)
> if error is 1:
> raise("Error downloading repo"
>
> I tried adding .wait(timeout=60) to the subprocess.Popen command but that
> didn't work.
>
> Any advice on whether there is an augmentation to the above, or a better
> approach, would be much appreciated. I need to solve this with standard
> python libs as I'm trying to make this as simple as possible for the user.
>
> The full script is here if that helps:
>
> https://github.com/mdekauwe/CABLE_benchmarking/blob/master/scripts/get_cable.py
You could also use the pysvn library that provides a pythonic api to drive svn
>From https://pysvn.sourceforge.io/ notes its not on PyPi but ther are kits for
>windows, mac. Debian and Fedora provide pysvn as well.
It allows you to provide the username and password via the api.
See https://pysvn.sourceforge.io/Docs/pysvn_prog_ref.html#pysvn_client_checkout
And
https://pysvn.sourceforge.io/Docs/pysvn_prog_ref.html#pysvn_client_callback_get_login
to provide the username and password.
Barry
Pysvn author
>
> Thanks
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
https://mail.python.org/mailman/listinfo/python-list