This repository was archived by the owner on Feb 14, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +42
-2
lines changed Expand file tree Collapse file tree 6 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -240,9 +240,11 @@ def build_and_pack_emscripten_env(
240
240
241
241
# Process environment.yml file
242
242
if environment_file and Path (environment_file ).exists ():
243
+ env_file = Path (environment_file )
244
+
243
245
bail_early = False
244
246
245
- with open (Path ( environment_file ) ) as f :
247
+ with open (env_file ) as f :
246
248
env_data = yaml .safe_load (f )
247
249
248
250
if env_data .get ("name" ) is not None :
@@ -260,7 +262,11 @@ def build_and_pack_emscripten_env(
260
262
if isinstance (dependency , str ) and dependency not in specs :
261
263
specs .append (dependency )
262
264
elif isinstance (dependency , dict ) and dependency .get ("pip" ) is not None :
263
- pip_dependencies = dependency ["pip" ]
265
+ # If it's a local Python package, make its path relative to the environment file
266
+ pip_dependencies = [
267
+ ((env_file .parent / pip_dep ).resolve () if os .path .isdir (env_file .parent / pip_dep ) else pip_dep )
268
+ for pip_dep in dependency ["pip" ]
269
+ ]
264
270
265
271
# Bail early if there is nothing to do
266
272
if bail_early and not force :
Original file line number Diff line number Diff line change
1
+ name : xeus-python-kernel-3
2
+ channels :
3
+ - https://repo.mamba.pm/emscripten-forge
4
+ - https://repo.mamba.pm/conda-forge
5
+ dependencies :
6
+ - numpy
7
+ - pip :
8
+ - .
Original file line number Diff line number Diff line change
1
+ [project ]
2
+ name = " test-package"
3
+ version = " 0.1.0"
Original file line number Diff line number Diff line change
1
+ print ('Hey' )
Original file line number Diff line number Diff line change @@ -90,6 +90,28 @@ def test_python_env_from_file_1():
90
90
os .remove (Path (addon .cwd .name ) / "empack_env_meta.json" )
91
91
92
92
93
+ def test_python_env_from_file_3 ():
94
+ app = LiteStatusApp (log_level = "DEBUG" )
95
+ app .initialize ()
96
+ manager = app .lite_manager
97
+
98
+ addon = XeusPythonEnv (manager )
99
+ addon .environment_file = "test_package/environment-3.yml"
100
+
101
+ for step in addon .post_build (manager ):
102
+ pass
103
+
104
+ # Test
105
+ assert os .path .isdir (
106
+ "/tmp/xeus-python-kernel/envs/xeus-python-kernel-3/lib/python3.10/site-packages/test_package"
107
+ )
108
+ assert os .path .isfile (
109
+ "/tmp/xeus-python-kernel/envs/xeus-python-kernel-3/lib/python3.10/site-packages/test_package/hey.py"
110
+ )
111
+
112
+ os .remove (Path (addon .cwd .name ) / "empack_env_meta.json" )
113
+
114
+
93
115
def test_python_env_from_file_2 ():
94
116
app = LiteStatusApp (log_level = "DEBUG" )
95
117
app .initialize ()
You can’t perform that action at this time.
0 commit comments