33
33
# Ensure the folder exists when we will look for files in it
34
34
os .makedirs (labstatic )
35
35
36
+ prebuilt_assets = [
37
+ (
38
+ "share/jupyter/labextensions/jupyterlab-plotly" ,
39
+ ["jupyterlab_plotly/labextension/package.json" ,],
40
+ ),
41
+ (
42
+ "share/jupyter/labextensions/jupyterlab-plotly/static" ,
43
+ [os .path .join (labstatic , f ) for f in os .listdir (labstatic )],
44
+ ),
45
+ (
46
+ "share/jupyter/nbextensions/jupyterlab-plotly" ,
47
+ [
48
+ "jupyterlab_plotly/nbextension/extension.js" ,
49
+ "jupyterlab_plotly/nbextension/index.js" ,
50
+ "jupyterlab_plotly/nbextension/index.js.LICENSE.txt" ,
51
+ ],
52
+ ),
53
+ ]
54
+
55
+
36
56
if "--skip-npm" in sys .argv or os .environ .get ("SKIP_NPM" ) is not None :
37
57
print ("Skipping npm install as requested." )
38
58
skip_npm = True
@@ -68,6 +88,7 @@ def run(self):
68
88
if not is_repo and all (os .path .exists (t ) for t in jsdeps .targets ):
69
89
# sdist, nothing to do
70
90
command .run (self )
91
+ self .distribution .data_files .extend (prebuilt_assets )
71
92
return
72
93
73
94
try :
@@ -94,26 +115,7 @@ def update_package_data(distribution):
94
115
95
116
# JS assets will not be present if we are skip npm build
96
117
if not skip_npm :
97
- distribution .data_files .extend (
98
- [
99
- (
100
- "share/jupyter/labextensions/jupyterlab-plotly" ,
101
- ["jupyterlab_plotly/labextension/package.json" ,],
102
- ),
103
- (
104
- "share/jupyter/labextensions/jupyterlab-plotly/static" ,
105
- [os .path .join (labstatic , f ) for f in os .listdir (labstatic )],
106
- ),
107
- (
108
- "share/jupyter/nbextensions/jupyterlab-plotly" ,
109
- [
110
- "jupyterlab_plotly/nbextension/extension.js" ,
111
- "jupyterlab_plotly/nbextension/index.js" ,
112
- "jupyterlab_plotly/nbextension/index.js.LICENSE.txt" ,
113
- ],
114
- ),
115
- ]
116
- )
118
+ distribution .data_files .extend (prebuilt_assets )
117
119
118
120
# re-init build_py options which load package_data
119
121
build_py .finalize_options ()
0 commit comments