jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Handle single quotes in usernames on Travis
......................................................................
[FIX] Handle single quotes in usernames on Travis
The username is written multiple times into the user-config surrounded by
single quotes. So if the username itself contains them these needs to be
escaped.
Bug: T105783
Change-Id: I54a7228f77e8cba653b25bd6e10bd4d4fee55e28
(cherry picked from commit b42724c107d62841a758a23f47d2e25da75a4052)
---
M .travis.yml
M tests/README.rst
2 files changed, 5 insertions(+), 5 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.travis.yml b/.travis.yml
index 0ffea0d..d4de620 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -44,10 +44,10 @@
- python -W error::UserWarning -m generate_user_files -dir:~/.pywikibot/
-family:$FAMILY -lang:$LANGUAGE -v -user:"$PYWIKIBOT2_USERNAME"
- if [[ -n "$USER_PASSWORD" && -n "$PYWIKIBOT2_USERNAME"
]]; then
- echo "usernames['wikipedia']['en'] =
'$PYWIKIBOT2_USERNAME'" >> ~/.pywikibot/user-config.py ;
- echo "usernames['wikipedia']['test'] =
'$PYWIKIBOT2_USERNAME'" >> ~/.pywikibot/user-config.py ;
- echo "usernames['wikidata']['test'] =
'$PYWIKIBOT2_USERNAME'" >> ~/.pywikibot/user-config.py ;
- echo "usernames['commons']['commons'] =
'$PYWIKIBOT2_USERNAME'" >> ~/.pywikibot/user-config.py ;
+ printf "usernames['wikipedia']['en'] = '%q'\n"
"$PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
+ printf "usernames['wikipedia']['test'] = '%q'\n"
"$PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
+ printf "usernames['wikidata']['test'] = '%q'\n"
"$PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
+ printf "usernames['commons']['commons'] = '%q'\n"
"$PYWIKIBOT2_USERNAME" >> ~/.pywikibot/user-config.py ;
printf "('%q', '%q')\n" "$PYWIKIBOT2_USERNAME"
"$USER_PASSWORD" > ~/.pywikibot/passwordfile ;
echo "import os" >> ~/.pywikibot/user-config.py ;
echo "password_file =
os.path.expanduser('~/.pywikibot/passwordfile')" >>
~/.pywikibot/user-config.py ;
diff --git a/tests/README.rst b/tests/README.rst
index 2f9f91a..b566cf4 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -109,7 +109,7 @@
4. The next build should run tests that require a logged in user
While passwords in travis-ci environment variables are not leaked in normal
-operations, you are responsible for your own passwords. If the password contains
+operations, you are responsible for your own passwords. If the variables contain
single quotes it is necessary to surround them in double quotes (see also
`travis-ci #4350 <https://github.com/travis-ci/travis-ci/issues/4350>`_).
--
To view, visit
https://gerrit.wikimedia.org/r/242522
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I54a7228f77e8cba653b25bd6e10bd4d4fee55e28
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>