2 # -*- coding: utf-8 -*-
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
19 from setuptools
import setup
, find_packages
20 from setuptools
.command
.install
import install
23 class Install_osm_im(install
):
24 """Generation of .py files from yang models"""
25 model_dir
= "models/yang"
28 def pipinstall(self
, package
):
29 """pip install for executable dependencies"""
30 subprocess
.call([sys
.executable
, "-m", "pip", "install", package
])
33 protoc_command
= ["make", "models"]
34 if subprocess
.call(protoc_command
) != 0:
37 # To ensure generated files are copied to the python installation folder
38 install_path
= "{}{}".format(self
.install_lib
, self
.im_dir
)
39 self
.copy_tree(self
.im_dir
, install_path
)
40 if os
.path
.isfile("{}/etsi-nfv-nsd.py".format(install_path
)):
42 "{}/etsi-nfv-nsd.py".format(install_path
), "{}/etsi_nfv_nsd.py".format(install_path
)
44 if os
.path
.isfile("{}/etsi-nfv-vnfd.py".format(install_path
)):
46 "{}/etsi-nfv-vnfd.py".format(install_path
), "{}/etsi_nfv_vnfd.py".format(install_path
)
54 description
='OSM Information Model',
55 long_description
=open('README.rst').read(),
56 version_command
=('git describe --tags --long --dirty --match v*', 'pep440-git-full'),
58 author_email
='osmsupport@etsi.org',
59 packages
=find_packages(),
60 include_package_data
=True,
61 setup_requires
=['setuptools-version-command'],
62 test_suite
='nose.collector',
63 url
='https://osm.etsi.org/gitweb/?p=osm/IM.git;a=summary',
65 cmdclass
={'install': Install_osm_im
},