0001-scripts-include-__file__-in-globals-24341.patch
wcs/scripts.py | ||
---|---|---|
29 | 29 |
for path in paths: |
30 | 30 |
script_path = os.path.join(path, script_name + '.py') |
31 | 31 |
if os.path.exists(script_path): |
32 |
self.__file__ = script_path |
|
32 | 33 |
self.code = open(script_path).read() |
33 | 34 |
break |
34 | 35 |
else: |
... | ... | |
45 | 46 |
def __call__(self, *args): |
46 | 47 |
data = get_publisher().substitutions.get_context_variables().copy() |
47 | 48 |
data['args'] = args |
49 |
data['__file__'] = self.__file__ |
|
48 | 50 |
code_object = compile(self.code, self.script_name, 'exec') |
49 | 51 |
eval(code_object, data) |
50 | 52 |
return data.get('result') |
51 |
- |