File tree 2 files changed +27
-9
lines changed
2 files changed +27
-9
lines changed Original file line number Diff line number Diff line change @@ -56,14 +56,8 @@ pull_chunked : submodules/chunked_requests
56
56
cd submodules/chunked_requests; git pull origin master
57
57
58
58
update_plotlyjs_for_offline :
59
- @echo " Updating plotly.js for Offline Mode "
59
+ @echo " Updating plotly.js"
60
60
@echo " ------------------"
61
- python -c " import urllib2;\
62
- cdn_url = ' https://cdn.plot.ly/plotly-latest.min.js' ; \
63
- response = urllib2.urlopen(cdn_url); \
64
- html = response.read ();\
65
- f = open(' ./plotly/package_data/plotly.min.js' , ' w' ); \
66
- f.write(html);\
67
- f.close()"
61
+ python setup.py updateplotlyjs
68
62
@echo " ---------------------------------"
69
63
@echo " Remember to update the CHANGELOG!"
Original file line number Diff line number Diff line change @@ -167,6 +167,29 @@ def run(self):
167
167
f .write (response .read ())
168
168
169
169
170
+ class DownloadPlotlyJsCommand (Command ):
171
+ description = 'Download latest version of the plot-schema JSON file'
172
+ user_options = []
173
+
174
+ def initialize_options (self ):
175
+ pass
176
+
177
+ def finalize_options (self ):
178
+ pass
179
+
180
+ def run (self ):
181
+ if sys .version_info .major != 3 :
182
+ raise ImportError ('Schema download must be executed with Python 3' )
183
+
184
+ import urllib .request
185
+ url = ('https://raw.githubusercontent.com/plotly/plotly.js/'
186
+ 'v%s/dist/plotly.min.js' % plotly_js_version )
187
+ with urllib .request .urlopen (url ) as response :
188
+
189
+ with open ('plotly/package_data/plotly.min.js' , 'wb' ) as f :
190
+ f .write (response .read ())
191
+
192
+
170
193
setup (name = 'plotly' ,
171
194
version = __version__ ,
172
195
use_2to3 = False ,
@@ -938,6 +961,7 @@ def run(self):
938
961
'sdist' : js_prerelease (sdist , strict = True ),
939
962
'jsdeps' : NPM ,
940
963
'codegen' : CodegenCommand ,
941
- 'updateschema' : DownloadSchemaCommand
964
+ 'updateschema' : DownloadSchemaCommand ,
965
+ 'updateplotlyjs' : DownloadPlotlyJsCommand
942
966
},
943
967
)
You can’t perform that action at this time.
0 commit comments