MO Transformation configs are missing in openvino-dev package (#5302)
* MO Transformation configs are missing in openvino-dev package * fix pylint issues * add escape Co-authored-by: Roman Donchenko <roman.donchenko@intel.com> * add escape Co-authored-by: Roman Donchenko <roman.donchenko@intel.com> * add mo_caffe.proto * Add MO package_data to openvino-dev package Co-authored-by: Roman Donchenko <roman.donchenko@intel.com>
This commit is contained in:
parent
1ae1757a5a
commit
7d5fd3d51c
@ -10,6 +10,10 @@ py_modules =
|
||||
[options.package_data]
|
||||
mo = *.txt
|
||||
compression.configs.hardware = *.json
|
||||
mo.extensions.front.mxnet = *.json
|
||||
mo.extensions.front.onnx = *.json
|
||||
mo.extensions.front.tf = *.json
|
||||
mo.mo.front.caffe.proto = *.proto
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
|
@ -9,23 +9,22 @@ Use this script to create a wheel with Model Optimizer code:
|
||||
$ python setup.py sdist bdist_wheel
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
from shutil import copyfile
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools.command.install import install
|
||||
from setuptools.command.build_py import build_py
|
||||
from shutil import copyfile
|
||||
|
||||
package_name = 'mo'
|
||||
PACKAGE_NAME = 'mo'
|
||||
|
||||
# Detect all the framework specific requirements_*.txt files.
|
||||
requirements_txt = []
|
||||
py_modules = []
|
||||
for name in os.listdir():
|
||||
if re.match('requirements(.*)\.txt', name):
|
||||
if re.match(r'requirements(.*)\.txt', name):
|
||||
requirements_txt.append(name)
|
||||
if re.match('mo(.*)\.py', name):
|
||||
if re.match(r'mo(.*)\.py', name):
|
||||
py_modules.append(name.split('.')[0])
|
||||
|
||||
# Minimal set of dependencies
|
||||
@ -42,22 +41,22 @@ class InstallCmd(install):
|
||||
install.run(self)
|
||||
# Create requirements.txt files for all the frameworks
|
||||
for name in requirements_txt:
|
||||
path = os.path.join(self.install_purelib, package_name, name)
|
||||
path = os.path.join(self.install_purelib, PACKAGE_NAME, name)
|
||||
with open(path, 'wt') as f:
|
||||
f.write('\n'.join(deps))
|
||||
# Add version.txt if exists
|
||||
version_txt = 'version.txt'
|
||||
if os.path.exists(version_txt):
|
||||
copyfile(os.path.join(version_txt),
|
||||
os.path.join(self.install_purelib, package_name, version_txt))
|
||||
|
||||
path = os.path.join(self.install_purelib, package_name, '__init__.py')
|
||||
os.path.join(self.install_purelib, PACKAGE_NAME, version_txt))
|
||||
|
||||
path = os.path.join(self.install_purelib, PACKAGE_NAME, '__init__.py')
|
||||
with open(path, 'wt') as f:
|
||||
f.write('import os, sys\n')
|
||||
f.write('from {} import mo\n'.format(package_name))
|
||||
f.write('from {} import mo\n'.format(PACKAGE_NAME))
|
||||
# This is required to fix internal imports
|
||||
f.write('sys.path.append(os.path.dirname(__file__))\n')
|
||||
# We install a package into custom folder "package_name".
|
||||
# We install a package into custom folder "PACKAGE_NAME".
|
||||
# Redirect import to model-optimizer/mo/__init__.py
|
||||
f.write('sys.modules["mo"] = mo')
|
||||
|
||||
@ -73,7 +72,7 @@ class BuildCmd(build_py):
|
||||
|
||||
|
||||
packages = find_packages()
|
||||
packages = [package_name + '.' + p for p in packages]
|
||||
packages = [PACKAGE_NAME + '.' + p for p in packages]
|
||||
|
||||
setup(name='openvino-mo',
|
||||
version='0.0.0',
|
||||
@ -81,7 +80,7 @@ setup(name='openvino-mo',
|
||||
author_email='openvino_pushbot@intel.com',
|
||||
url='https://github.com/openvinotoolkit/openvino',
|
||||
packages=packages,
|
||||
package_dir={package_name: '.'},
|
||||
package_dir={PACKAGE_NAME: '.'},
|
||||
py_modules=py_modules,
|
||||
cmdclass={
|
||||
'install': InstallCmd,
|
||||
@ -92,6 +91,12 @@ setup(name='openvino-mo',
|
||||
'mo = mo.__main__:main',
|
||||
],
|
||||
},
|
||||
package_data={
|
||||
'mo.mo.front.caffe.proto': ['*.proto'],
|
||||
'mo.extensions.front.mxnet': ['*.json'],
|
||||
'mo.extensions.front.onnx': ['*.json'],
|
||||
'mo.extensions.front.tf': ['*.json'],
|
||||
},
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
|
Loading…
Reference in New Issue
Block a user