add PyPI package setup for validation-scripts

Change-Id: Idba084a548b53ae2d133d76906c265983f277e4c
Issue-ID: VNFSDK-39
Signed-off-by: Mickael JEZEQUEL <mickael.jezequel@orange.com>
diff --git a/pom.xml b/pom.xml
index ad7e6b3..0632691 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <!--
-Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved.
+Copyright (c) 2018 Orange. All rights reserved.
 
 Licensed under the Apache License, Version 2.0 (the "License"); you may
 not use this file except in compliance with the License. You may obtain
@@ -16,8 +16,6 @@
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
-    <packaging>pom</packaging>
-
     <parent>
         <groupId>org.onap.oparent</groupId>
         <artifactId>oparent</artifactId>
@@ -26,36 +24,13 @@
     </parent>
 
     <groupId>org.onap.vnfsdk.ice</groupId>
-    <artifactId>vnf-sdk-ice-scripts</artifactId>
+    <artifactId>vnf-sdk-ice</artifactId>
+    <packaging>pom</packaging>
 
-    <name>vnfsdk-ice-scripts</name>
-    <description>python scripts for HEAT template validation</description>
-    <properties>
-      <sonar.language>py</sonar.language>
-      <sonar.pluginName>Python</sonar.pluginName>
-      <sonar.inclusions>**/*.py</sonar.inclusions>
-      <sonar.skip>false</sonar.skip>
-    </properties>
-    <build>
-      <plugins>
-        <plugin>
-            <artifactId>maven-assembly-plugin</artifactId>
-            <configuration>
-                <appendAssemblyId>false</appendAssemblyId>
-                <descriptors>
-                    <descriptor>assembly.xml</descriptor>
-                </descriptors>
-            </configuration>
-            <executions>
-                <execution>
-                    <id>make-assembly</id>
-                    <phase>package</phase>
-                    <goals>
-                        <goal>single</goal>
-                    </goals>
-                </execution>
-            </executions>
-        </plugin>
-      </plugins>
-    </build>
+    <name>vnfsdk-ice</name>
+    <description>HEAT template validation</description>
+
+    <modules>
+        <module>validation-scripts</module>
+    </modules>
 </project>
diff --git a/assembly.xml b/validation-scripts/assembly.xml
similarity index 82%
rename from assembly.xml
rename to validation-scripts/assembly.xml
index e73d3f4..5a20fc3 100644
--- a/assembly.xml
+++ b/validation-scripts/assembly.xml
@@ -23,12 +23,14 @@
     </formats>
     <fileSets>
         <fileSet>
+            <directory>.</directory>
             <includes>
-                <include>validation-scripts/LICENSE.txt</include>
-                <include>validation-scripts/README.md</include>
+                <include>LICENSE.txt</include>
+                <include>README.md</include>
                 <include>requirements.txt</include>
-                <include>setup.py</include>
-                <include>validation-scripts/ice_validator/**</include>
+                <include>tox.ini</include>
+                <include>*.py</include>
+                <include>ice_validator/**/*.py</include>
             </includes>
             <excludes>
                 <exclude>**/*.pyc</exclude>
diff --git a/validation-scripts/pom.xml b/validation-scripts/pom.xml
new file mode 100644
index 0000000..a08f8af
--- /dev/null
+++ b/validation-scripts/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<!--
+Copyright (c) 2018 Orange. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may
+not use this file except in compliance with the License. You may obtain
+a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.onap.oparent</groupId>
+        <artifactId>oparent</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+        <relativePath>../../oparent</relativePath>
+    </parent>
+
+    <groupId>org.onap.vnfsdk.ice</groupId>
+    <artifactId>vnf-sdk-ice-scripts</artifactId>
+    <packaging>pom</packaging>
+
+    <name>vnfsdk-ice-scripts</name>
+    <description>python scripts for HEAT template validation</description>
+    <properties>
+      <sonar.language>py</sonar.language>
+      <sonar.pluginName>Python</sonar.pluginName>
+      <sonar.inclusions>**/*.py</sonar.inclusions>
+      <sonar.skip>false</sonar.skip>
+    </properties>
+    <build>
+      <plugins>
+        <plugin>
+            <artifactId>maven-assembly-plugin</artifactId>
+            <configuration>
+                <appendAssemblyId>false</appendAssemblyId>
+                <descriptors>
+                    <descriptor>assembly.xml</descriptor>
+                </descriptors>
+            </configuration>
+            <executions>
+                <execution>
+                    <id>make-assembly</id>
+                    <phase>package</phase>
+                    <goals>
+                        <goal>single</goal>
+                    </goals>
+                </execution>
+            </executions>
+        </plugin>
+      </plugins>
+    </build>
+</project>
diff --git a/validation-scripts/setup.py b/validation-scripts/setup.py
new file mode 100644
index 0000000..3023df8
--- /dev/null
+++ b/validation-scripts/setup.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python

+

+#

+# Copyright (c) 2018 Orange. All rights reserved.

+#

+# Licensed under the Apache License, Version 2.0 (the "License"); you may

+# not use this file except in compliance with the License. You may obtain

+# a copy of the License at

+#

+#      http://www.apache.org/licenses/LICENSE-2.0

+#

+# Unless required by applicable law or agreed to in writing, software

+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

+# License for the specific language governing permissions and limitations

+# under the License.

+#

+

+import os

+from setuptools import setup, find_packages

+import sys

+

+if sys.version_info < (2, 7):

+    sys.exit('VNF SDK requires Python 2.7+')

+

+root_dir = os.path.dirname(__file__)

+install_requires = []

+extras_require = {}

+

+with open(os.path.join(root_dir, 'requirements.txt')) as requirements:

+    for requirement in requirements.readlines():

+        # get rid of comments or trailing comments

+        requirement = requirement.split('#')[0].strip()

+        if not requirement:

+            continue # skip empty and comment lines

+        # dependencies which use environment markers have to go in as

+        # conditional dependencies under "extra_require", see more at:

+        # https://wheel.readthedocs.io/en/latest/index.html#defining-conditional-dependencies

+        if ';' in requirement:

+            package, condition = requirement.split(';')

+            cond_name = ':{0}'.format(condition.strip())

+            extras_require.setdefault(cond_name, [])

+            extras_require[cond_name].append(package.strip())

+        else:

+            install_requires.append(requirement)

+

+# read __version__

+exec(open('./version.py').read())

+

+setup(

+    name='vnfsdk-ice-scripts',

+    version= __version__,

+    description='VNF SDK Heat validation scripts',

+    license='Apache License Version 2.0',

+    url='http://onap.org/',

+

+    packages=find_packages('.'),

+

+    package_dir={'ice_validator': 'ice_validator'},

+

+    include_package_data=True,

+    install_requires=install_requires,

+    extras_require=extras_require)

+

diff --git a/validation-scripts/version.py b/validation-scripts/version.py
new file mode 100644
index 0000000..1f356cc
--- /dev/null
+++ b/validation-scripts/version.py
@@ -0,0 +1 @@
+__version__ = '1.0.0'