File tree Expand file tree Collapse file tree 3 files changed +23
-7
lines changed
ask-sdk-local-debug/ask_sdk_local_debug/config Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change 1515# specific language governing permissions and limitations under the
1616# License.
1717#
18+ import os
19+ import sys
1820import typing
1921import importlib .util
2022
@@ -82,8 +84,22 @@ def __initialize_skill_invoker(self):
8284 self .skill_file_path , str (e )))
8385 return skill_invoker
8486
87+ def __load_skill_handler_dir_path (self ):
88+ # type: () -> None
89+ """Loads skill handler directory path into PYTHONPATH.
90+
91+ For local module/package resolution, this method loads the
92+ directory containing the skill handler file into the
93+ python path, so that the interpreter will be able to resolve
94+ the needed imports during runtime.
95+ """
96+ skill_dir = os .path .dirname (self .skill_file_path )
97+ if skill_dir not in sys .path :
98+ sys .path .append (skill_dir )
99+
85100 def __get_skill_builder_func (self ):
86101 try :
102+ self .__load_skill_handler_dir_path ()
87103 return getattr (self .__initialize_skill_invoker (), self .skill_handler )
88104 except Exception as e :
89105 raise LocalDebugSdkException (
Original file line number Diff line number Diff line change @@ -22,13 +22,13 @@ sdk_packages = [
2222if sys .version_info .major == 3 :
2323 sdk_packages .extend (["django-ask-sdk" , "ask-sdk-local-debug" ])
2424
25- run ("pip install coverage" )
25+ run ("python -m pip install coverage" )
2626
2727for pkg in sdk_packages :
2828 os .chdir (os .path .join (REPO_ROOT , pkg ))
29- run ("pip install -r requirements.txt" )
29+ run ("python -m pip install -r requirements.txt" )
3030 if os .path .isdir ('dist' ) and os .listdir ('dist' ):
3131 shutil .rmtree ('dist' )
3232 run ('python setup.py bdist_wheel' )
3333 wheel_dist = os .listdir ('dist' )[0 ]
34- run ('pip install %s' % (os .path .join ('dist' , wheel_dist )))
34+ run ('python -m pip install %s' % (os .path .join ('dist' , wheel_dist )))
Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ setenv =
2626 AWS_DEFAULT_REGION = us-west-2
2727commands =
2828 flake8 .
29- pip install --upgrade pip
30- pip install --upgrade wheel
29+ python -m pip install --upgrade pip
30+ python -m pip install --upgrade wheel
3131 {toxinidir}/scripts/ci/sdk_install
3232 {toxinidir}/scripts/ci/run_tests
3333 py{36,37,38}: mypy ask-sdk/ask_sdk
@@ -53,8 +53,8 @@ setenv =
5353 AWS_DEFAULT_REGION = us-west-2
5454commands =
5555 flake8 .
56- pip install --upgrade pip
57- pip install --upgrade wheel
56+ python -m pip install --upgrade pip
57+ python -m pip install --upgrade wheel
5858 python {toxinidir}\scripts\ci\sdk_install
5959 python {toxinidir}\scripts\ci\run_tests
6060 mypy ask-sdk\ask_sdk
You can’t perform that action at this time.
0 commit comments