Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Issue 2925453002: [context] Add path prefix/suffix manipulation. (Closed)

Created:
3 years, 6 months ago by dnj
Modified:
3 years, 6 months ago
Reviewers:
iannucci
CC:
chromium-reviews, infra-reviews+recipes-py_chromium.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

[context] Add path prefix/suffix manipulation. Add the ability to manipulate pathsep-delimited environment variables more easily with specific helper functions targeting the prefixing and suffixing of values to those variables. Previously, the supported way to augment path environment variables was to manually construct them, referencing the current value: new_path = "%s%%(PATH)s%s" % (api.path.pathsep, api.path.pathsep) Not only is this very verbose, but it is also error-prone, as the user may not use OS-specific path separators, can add the same entries multiple times, and can forget the double-percent to escape the inner substitition. This patch adds the concept of path prefixes and suffixes to the "context" recipe module. Path elements can be added to either, and will be compiled into properly-delimited prefix and suffix values on the context's environment. BUG=None TEST=expectations,run Review-Url: https://codereview.chromium.org/2925453002 Committed: https://github.com/luci/recipes-py/commit/c40412cbc4e1b8ee1e6eba2e88328ca71c6ec1e4

Patch Set 1 #

Patch Set 2 : advise #

Total comments: 19

Patch Set 3 : comments, use sentinels #

Total comments: 10

Patch Set 4 : comments #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+162 lines, -52 lines) Patch
M recipe_engine/step_runner.py View 3 chunks +6 lines, -1 line 0 comments Download
M recipe_modules/context/__init__.py View 1 2 1 chunk +1 line, -1 line 0 comments Download
M recipe_modules/context/api.py View 1 2 3 6 chunks +68 lines, -42 lines 0 comments Download
M recipe_modules/context/examples/full.py View 1 2 1 chunk +10 lines, -4 lines 0 comments Download
M recipe_modules/context/examples/full.expected/basic.json View 1 2 2 chunks +14 lines, -3 lines 0 comments Download
M recipe_modules/context/tests/env.py View 1 2 3 1 chunk +18 lines, -0 lines 0 comments Download
M recipe_modules/context/tests/env.expected/basic.json View 1 2 3 1 chunk +44 lines, -0 lines 0 comments Download
M recipe_modules/python/examples/full.expected/basic.json View 1 2 1 chunk +1 line, -1 line 1 comment Download

Messages

Total messages: 20 (9 generated)
dnj
advise
3 years, 6 months ago (2017-06-03 15:35:22 UTC) #1
dnj
PTAL. Seemed like a good idea.
3 years, 6 months ago (2017-06-03 15:35:37 UTC) #3
dnj
https://codereview.chromium.org/2925453002/diff/20001/recipe_engine/step_runner.py File recipe_engine/step_runner.py (right): https://codereview.chromium.org/2925453002/diff/20001/recipe_engine/step_runner.py#newcode710 recipe_engine/step_runner.py:710: result[str(k)] = str(v) % subst This fixes a bug ...
3 years, 6 months ago (2017-06-03 15:37:34 UTC) #4
iannucci
https://codereview.chromium.org/2925453002/diff/20001/recipe_engine/step_runner.py File recipe_engine/step_runner.py (right): https://codereview.chromium.org/2925453002/diff/20001/recipe_engine/step_runner.py#newcode710 recipe_engine/step_runner.py:710: result[str(k)] = str(v) % subst On 2017/06/03 15:37:33, dnj ...
3 years, 6 months ago (2017-06-05 19:23:05 UTC) #9
iannucci
https://codereview.chromium.org/2925453002/diff/20001/recipe_modules/context/api.py File recipe_modules/context/api.py (right): https://codereview.chromium.org/2925453002/diff/20001/recipe_modules/context/api.py#newcode266 recipe_modules/context/api.py:266: cur = cur.split(os.pathsep) if cur else [] this will ...
3 years, 6 months ago (2017-06-05 19:24:05 UTC) #10
dnj
https://codereview.chromium.org/2925453002/diff/20001/recipe_engine/step_runner.py File recipe_engine/step_runner.py (right): https://codereview.chromium.org/2925453002/diff/20001/recipe_engine/step_runner.py#newcode710 recipe_engine/step_runner.py:710: result[str(k)] = str(v) % subst On 2017/06/05 19:23:04, iannucci ...
3 years, 6 months ago (2017-06-07 02:59:29 UTC) #11
iannucci
lgtm w/ comments https://codereview.chromium.org/2925453002/diff/40001/recipe_engine/step_runner.py File recipe_engine/step_runner.py (right): https://codereview.chromium.org/2925453002/diff/40001/recipe_engine/step_runner.py#newcode702 recipe_engine/step_runner.py:702: else collections.defaultdict(lambda: '', **original)) let's separate ...
3 years, 6 months ago (2017-06-07 23:17:59 UTC) #12
dnj
https://codereview.chromium.org/2925453002/diff/40001/recipe_engine/step_runner.py File recipe_engine/step_runner.py (right): https://codereview.chromium.org/2925453002/diff/40001/recipe_engine/step_runner.py#newcode702 recipe_engine/step_runner.py:702: else collections.defaultdict(lambda: '', **original)) On 2017/06/07 23:17:59, iannucci wrote: ...
3 years, 6 months ago (2017-06-07 23:48:47 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2925453002/60001
3 years, 6 months ago (2017-06-07 23:50:12 UTC) #16
commit-bot: I haz the power
Committed patchset #4 (id:60001) as https://github.com/luci/recipes-py/commit/c40412cbc4e1b8ee1e6eba2e88328ca71c6ec1e4
3 years, 6 months ago (2017-06-07 23:53:22 UTC) #19
iannucci
3 years, 6 months ago (2017-06-08 00:46:59 UTC) #20
Message was sent while issue was closed.
fix https://codereview.chromium.org/2920223011

https://codereview.chromium.org/2925453002/diff/60001/recipe_modules/python/e...
File recipe_modules/python/examples/full.expected/basic.json (right):

https://codereview.chromium.org/2925453002/diff/60001/recipe_modules/python/e...
recipe_modules/python/examples/full.expected/basic.json:35: "PYTHONUNBUFFERED":
""
damn I missed this >_<

Powered by Google App Engine
This is Rietveld 408576698