Fix bug 1731: backwards compatibility of relations
[osm/IM.git] / setup.py
index ef8da90..ec75988 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -33,27 +33,25 @@ class Install_osm_im(install):
         self.pipinstall('pyang')
         self.pipinstall('pyangbind')
         import pyangbind
-        print("Creating dir {}/{} for python artifacts".format(os.getcwd(), self.im_dir))
+        print("Using dir {}/{} for python artifacts".format(os.getcwd(), self.im_dir))
         path = "{}/{}".format(os.getcwd(), self.im_dir)
-        if not os.path.exists(path):
-            os.makedirs(path)
-        open("{}/{}/__init__.py".format(os.getcwd(), self.im_dir), 'a').close()
-        for files_item in ['vnfd', 'nsd', 'nst']:
-            protoc_command = ["pyang",
-                              "-Werror",
-                              "--plugindir",
-                              "{}/plugin".format(os.path.dirname(pyangbind.__file__)),
-                              "--path",
-                              self.model_dir,
-                              "-f", "pybind",
-                              "-o",
-                              "{}/{}.py".format(self.im_dir, files_item),
-                              "{}/{}.yang".format(self.model_dir, files_item)]
-            print("Generating {}.py from {}.yang".format(files_item, files_item))
-            if subprocess.call(protoc_command) != 0:
-                sys.exit(-1)
+
+        protoc_command = ["make", "models"]
+        if subprocess.call(protoc_command) != 0:
+            sys.exit(-1)
+
         # To ensure generated files are copied to the python installation folder
-        self.copy_tree(self.im_dir, "{}{}".format(self.install_lib, self.im_dir))
+        install_path = "{}{}".format(self.install_lib, self.im_dir)
+        self.copy_tree(self.im_dir, install_path)
+        if os.path.isfile("{}/etsi-nfv-nsd.py".format(install_path)):
+            self.move_file(
+                "{}/etsi-nfv-nsd.py".format(install_path), "{}/etsi_nfv_nsd.py".format(install_path)
+            )
+        if os.path.isfile("{}/etsi-nfv-vnfd.py".format(install_path)):
+            self.move_file(
+                "{}/etsi-nfv-vnfd.py".format(install_path), "{}/etsi_nfv_vnfd.py".format(install_path)
+            )
+
         install.run(self)
 
 
@@ -62,12 +60,11 @@ setup(
     description='OSM Information Model',
     long_description=open('README.rst').read(),
     version_command=('git describe --tags --long --dirty --match v*', 'pep440-git-full'),
-    author='Mike Marchetti',
-    author_email='mmarchetti@sandvine.com',
+    author='OSM Support',
+    author_email='osmsupport@etsi.org',
     packages=find_packages(),
     include_package_data=True,
     setup_requires=['setuptools-version-command'],
-    install_requires=['pyang', 'pyangbind'],
     test_suite='nose.collector',
     url='https://osm.etsi.org/gitweb/?p=osm/IM.git;a=summary',
     license='Apache 2.0',