This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Python variables are not accessible when script is sourced from a file listed in buildfile.includes section #182
Comments
If someone wonders why we would want to do that, here is the real change [1] |
With this reproducer it's easy to see the problem and the workaround: [1]. |
We've a patch landing for this soon. Thanks for the report and test. |
Thanks for such a detailed bug report! This undesirable behavior (and a few others) is caused by how we currently handle "include_defs" and python globals. We're working on remodeling this around python modules, which should fix a number of issues (and I've confirmed it fixes this issue), and hope to have it pushed soon. |
Heh, completely missed Simon's comment. |
openstack-gerrit
pushed a commit
to openstack-infra/gerrit
that referenced
this issue
Oct 29, 2014
This version fixes a critical bug [1] that prevents us from simplifying bucklets intergration. In this version, Buck only allows defining new rule functions in files included with include_defs, not actually instantiating rules, so we need to reshuffle some rules. After this commit [2] "$(macro ...)" syntax is preserved for buck macros, we need to use a backslash to send commands directly to the shell: "\$(macro ...)". It turns out this doesn't work yet, shell backticks seem to work though [3]. [1] facebook/buck#182 [2] facebook/buck@d6f3252 [3] facebook/buck#212 Change-Id: Ie99757bafc626d4ac2c5a75a2983d91b0c4f6d24
openstack-gerrit
pushed a commit
to openstack-infra/gerrit
that referenced
this issue
Nov 25, 2014
The fix for [1] prevents from importing python variables __foo__, as explained in [2]. Rename standalone mode flag correspondingly. [1] facebook/buck#182 [2] facebook/buck#221 Change-Id: If8682278e7c91df3fc18b3d623eb43950e839448
davido
added a commit
to davido/bucklets
that referenced
this issue
Mar 21, 2015
The fix for [1] prevents from importing python variables __foo__, as explained in [2]. Rename standalone mode flag correspondingly. [1] facebook/buck#182 [2] facebook/buck#221 Change-Id: I0ac05c80a1d5fc1b8f8bd2c5ca5dabdfeeecbe52
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Found on 63e0e52.
Including a python file (VERSION) directly works as expected, particularly variables that defined in it are exposed to the caller:
Given this VERSION file:
and gerrit_plugin.bucklet:
And this BUCK build file:
All is just fine:
When we make use of
.buckconfig
andbuildfile.includes
section there and include bucklet from a file that listed in this section, it doesn't work, e. g.:And include
gerrit_plugin.bucklet
not directly, but frombucklets.defs
that is specified in.buckconfig
file:And remove the include from BUCK:
It doesn't work any more, PLUGIN_VERSION cannt be accessed, even though the file '//VERSION' seems to be correctly imported:
The text was updated successfully, but these errors were encountered: