|
|
@@ -6,6 +6,7 @@ import json
|
|
|
import os
|
|
|
import setuptools
|
|
|
import setuptools.command.build_py
|
|
|
+import distutils.command.build
|
|
|
|
|
|
node_dependencies = [
|
|
|
( 'netron', [
|
|
|
@@ -37,7 +38,27 @@ node_dependencies = [
|
|
|
'node_modules/npm-font-open-sans/fonts/Bold/OpenSans-Bold.woff2' ])
|
|
|
]
|
|
|
|
|
|
+class build(distutils.command.build.build):
|
|
|
+ user_options = distutils.command.build.build.user_options + [ ('version', None, 'lalala' ) ]
|
|
|
+ def initialize_options(self):
|
|
|
+ distutils.command.build.build.initialize_options(self)
|
|
|
+ self.version = None
|
|
|
+ def finalize_options(self):
|
|
|
+ distutils.command.build.build.finalize_options(self)
|
|
|
+ def run(self):
|
|
|
+ if self.version:
|
|
|
+ build_py.version = True;
|
|
|
+ else:
|
|
|
+ build_py.version = False;
|
|
|
+ return distutils.command.build.build.run(self)
|
|
|
+
|
|
|
class build_py(setuptools.command.build_py.build_py):
|
|
|
+ user_options = setuptools.command.build_py.build_py.user_options + [ ('version', None, 'lalala' ) ]
|
|
|
+ def initialize_options(self):
|
|
|
+ setuptools.command.build_py.build_py.initialize_options(self)
|
|
|
+ self.version = None
|
|
|
+ def finalize_options(self):
|
|
|
+ setuptools.command.build_py.build_py.finalize_options(self)
|
|
|
def run(self):
|
|
|
result = setuptools.command.build_py.build_py.run(self)
|
|
|
for target, files in node_dependencies:
|
|
|
@@ -49,7 +70,7 @@ class build_py(setuptools.command.build_py.build_py):
|
|
|
return result
|
|
|
def build_module(self, module, module_file, package):
|
|
|
setuptools.command.build_py.build_py.build_module(self, module, module_file, package)
|
|
|
- if module == '__version__':
|
|
|
+ if build_py.version and module == '__version__':
|
|
|
package = package.split('.')
|
|
|
outfile = self.get_module_outfile(self.build_lib, package, module)
|
|
|
with open(outfile, 'w+') as f:
|
|
|
@@ -74,6 +95,7 @@ setuptools.setup(
|
|
|
],
|
|
|
license="MIT",
|
|
|
cmdclass={
|
|
|
+ 'build': build,
|
|
|
'build_py': build_py
|
|
|
},
|
|
|
package_dir={
|
|
|
@@ -85,6 +107,7 @@ setuptools.setup(
|
|
|
package_data={
|
|
|
'netron': [
|
|
|
'favicon.ico', 'icon.png',
|
|
|
+ 'numpy.js', 'zip.js', 'tar.js', 'gzip.js',
|
|
|
'onnx.js', 'onnx.js', 'onnx-metadata.json',
|
|
|
'coreml.js', 'coreml-metadata.json', 'coreml-proto.js',
|
|
|
'caffe.js', 'caffe-metadata.json', 'caffe-proto.js',
|
|
|
@@ -96,7 +119,6 @@ setuptools.setup(
|
|
|
'sklearn.js', 'sklearn-metadata.json',
|
|
|
'tf.js', 'tf-metadata.json', 'tf-proto.js',
|
|
|
'tflite.js', 'tflite-metadata.json', 'tflite-schema.js',
|
|
|
- 'numpy.js', 'zip.js', 'tar.js', 'gzip.js',
|
|
|
'view-browser.html', 'view-browser.js',
|
|
|
'view-grapher.css', 'view-grapher.js',
|
|
|
'view-sidebar.css', 'view-sidebar.js',
|