Skip to content

Commit

Permalink
Use a less restrictive path check.
Browse files Browse the repository at this point in the history
Using a restrictive path check means it won't work with packages where actions
run inside a virtualenv.
  • Loading branch information
Kami committed Dec 4, 2016
1 parent c0a968b commit 8af15c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions st2common/st2common/runners/python_action_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import sys

# Note: This work-around is required to fix the issue with other Python modules which live
# inside this directory polluting and masking sys.path for Python runner actions.
# Since this module is ran as a Python script inside a subprocess, directory where the script
# lives gets added to sys.path and we don't want that.
# Note: We need to use just the suffix, because full path is different depending if the process
# is ran in virtualenv or not
RUNNERS_PATH_SUFFIX = 'st2common/runners'
if __name__ == '__main__':
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
script_path = sys.path[0]
if BASE_DIR in script_path:
if RUNNERS_PATH_SUFFIX in script_path:
sys.path.pop(0)

import sys
Expand Down

0 comments on commit 8af15c1

Please sign in to comment.