Add templating engine 35/85135/2
authorDR695H <dr695h@att.com>
Fri, 12 Apr 2019 02:49:34 +0000 (22:49 -0400)
committerDR695H <dr695h@att.com>
Fri, 12 Apr 2019 03:06:24 +0000 (23:06 -0400)
flesh out the setup.py, add in a jinja template engine Python2.7
Also enhanced gitignore and added a pom.xml to eventually start
getting this into the nexus3 repo

Change-Id: I0fbef46941211fdbffe183614fba0c08edc9ed31
Issue-ID: TEST-140
Signed-off-by: DR695H <dr695h@att.com>
.gitignore
eteutils/TemplatingEngine.py [new file with mode: 0644]
pom.xml [new file with mode: 0644]
setup.py

index b6aecf9..70a57dd 100644 (file)
@@ -1,2 +1,262 @@
 .tox/*
 python_openecomp_eteutils.egg-info/*
+
+# Created by https://www.gitignore.io/api/node,sonar,maven,eclipse,sonarqube,intellij+all
+
+### Eclipse ###
+
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.settings/
+.loadpath
+.recommenders
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# PyDev specific (Python IDE for Eclipse)
+*.pydevproject
+
+# CDT-specific (C/C++ Development Tooling)
+.cproject
+
+# CDT- autotools
+.autotools
+
+# Java annotation processor (APT)
+.factorypath
+
+# PDT-specific (PHP Development Tools)
+.buildpath
+
+# sbteclipse plugin
+.target
+
+# Tern plugin
+.tern-project
+
+# TeXlipse plugin
+.texlipse
+
+# STS (Spring Tool Suite)
+.springBeans
+
+# Code Recommenders
+.recommenders/
+
+# Annotation Processing
+.apt_generated/
+
+# Scala IDE specific (Scala & Java development for Eclipse)
+.cache-main
+.scala_dependencies
+.worksheet
+
+### Eclipse Patch ###
+# Eclipse Core
+.project
+
+# JDT-specific (Eclipse Java Development Tools)
+.classpath
+
+# Annotation Processing
+.apt_generated
+
+.sts4-cache/
+
+### Intellij+all ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
+
+# Generated files
+.idea/**/contentModel.xml
+
+# Sensitive or high-churn files
+.idea/**/dataSources/
+.idea/**/dataSources.ids
+.idea/**/dataSources.local.xml
+.idea/**/sqlDataSources.xml
+.idea/**/dynamic.xml
+.idea/**/uiDesigner.xml
+.idea/**/dbnavigator.xml
+
+# Gradle
+.idea/**/gradle.xml
+.idea/**/libraries
+
+# Gradle and Maven with auto-import
+# When using Gradle or Maven with auto-import, you should exclude module files,
+# since they will be recreated, and may cause churn.  Uncomment if using
+# auto-import.
+# .idea/modules.xml
+# .idea/*.iml
+# .idea/modules
+
+# CMake
+cmake-build-*/
+
+# Mongo Explorer plugin
+.idea/**/mongoSettings.xml
+
+# File-based project format
+*.iws
+
+# IntelliJ
+out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Cursive Clojure plugin
+.idea/replstate.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+# Editor-based Rest Client
+.idea/httpRequests
+
+# Android studio 3.1+ serialized cache file
+.idea/caches/build_file_checksums.ser
+
+### Intellij+all Patch ###
+# Ignores the whole .idea folder and all .iml files
+# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
+
+.idea/
+
+# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
+
+*.iml
+modules.xml
+.idea/misc.xml
+*.ipr
+
+### Maven ###
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+.mvn/wrapper/maven-wrapper.jar
+
+### Node ###
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+jspm_packages/
+
+# TypeScript v1 declaration files
+typings/
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+
+# parcel-bundler cache (https://parceljs.org/)
+.cache
+
+# next.js build output
+.next
+
+# nuxt.js build output
+.nuxt
+
+# vuepress build output
+.vuepress/dist
+
+# Serverless directories
+.serverless
+
+### Sonar ###
+#Sonar generated dir
+/.sonar/
+
+### SonarQube ###
+# SonarQube ignore files.
+#
+# https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner
+# Sonar Scanner working directories
+.sonar/
+.scannerwork/
+
+# http://www.sonarlint.org/commandline/
+# SonarLint working directories, configuration files (including credentials)
+.sonarlint/
+
+
+# End of https://www.gitignore.io/api/node,sonar,maven,eclipse,sonarqube,intellij+all
+.flattened-pom.xml
\ No newline at end of file
diff --git a/eteutils/TemplatingEngine.py b/eteutils/TemplatingEngine.py
new file mode 100644 (file)
index 0000000..0f579e7
--- /dev/null
@@ -0,0 +1,34 @@
+# Copyright 2019 AT&T Intellectual Property. 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.
+
+
+from jinja2 import Environment, FileSystemLoader, select_autoescape
+
+
+class TemplatingEngine:
+    """TemplateImporter is common resource for templating with strings."""
+
+    jinja_env = None
+
+    def __init__(self, templates_folder):
+        self.jinja_env = Environment(
+            loader=FileSystemLoader(templates_folder),
+            autoescape=select_autoescape(['html', 'xml'])
+        )
+
+    def apply_template(self, template_location, values):
+        """returns a string that is the jinja template in template_location filled in via the dictionary in values """
+        print
+        template = self.jinja_env.get_template(template_location)
+        return template.render(values)
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644 (file)
index 0000000..b196873
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<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>
+       <groupId>org.onap.testsuite</groupId>
+       <artifactId>python-testing-utils</artifactId>
+       <name>testsuite-python-testing-utils</name>
+       <version>0.3.0-SNAPSHOT</version>
+       <description>Scripts written to be used during robot framework testing</description>
+       <parent>
+               <groupId>org.onap.oparent</groupId>
+               <artifactId>oparent-python</artifactId>
+               <version>1.2.3</version>
+       </parent>
+       <properties>
+               <wheel.name>${project.artifactId}-${python_version}-py2-none-any.whl</wheel.name>
+               <python.sourceDirectory>${project.basedir}</python.sourceDirectory>
+        <python.pypi.repository>https://nexus3.onap.org/repository/PyPi.snapshot/</python.pypi.repository>
+       </properties>
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.codehaus.mojo</groupId>
+                               <artifactId>build-helper-maven-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <id>attach-artifacts</id>
+                                               <configuration>
+                                                       <artifacts>
+                                                               <artifact>
+                                                                       <file>${project.build.directory}/maven-python/dist/${wheel.name}</file>
+                                                                       <type>whl</type>
+                                                               </artifact>
+                                                       </artifacts>
+                                                       <skipAttach>false</skipAttach>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <plugin>
+                               <groupId>com.github.UltimateDogg</groupId>
+                               <artifactId>maven-python-distribute-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>package</id>
+                        <goals>
+                            <goal>package</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>process</id>
+                        <goals>
+                            <goal>process-sources</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>deploy</id>
+                        <goals>
+                            <goal>deploy</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                               <configuration>
+                    <repository>${python.pypi.repository}</repository>
+                                       <sourceDirectory>${python.sourceDirectory}</sourceDirectory>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <artifactId>exec-maven-plugin</artifactId>
+                               <groupId>org.codehaus.mojo</groupId>
+                               <executions>
+                                       <execution>
+                                               <id>tox-test</id>
+                                               <configuration>
+                                                       <workingDirectory>${project.build.directory}/maven-python/eteutils</workingDirectory>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+               </plugins>
+       </build>
+</project>
\ No newline at end of file
index 3b7d23e..7c8d9ff 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,48 @@
+# Copyright 2019 AT&T Intellectual Property. 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.
+
+
 from setuptools import setup
 
 setup(
     name='python-openecomp-eteutils',            # This is the name of your PyPI-package.
-    version='0.2',                          # Update the version number for new releases
-    description='Scripts written to be used during ete testing',    # Info about script
-    install_requires=['dnspython','paramiko', 'pyyaml', 'robotframework', 'deepdiff>=2.5,<3.3'], # what we need
-    packages=['eteutils', 'loadtest'],       # The name of your scipts package
-    package_dir={'eteutils': 'eteutils', 'loadtest' : 'loadtest'} # The location of your scipts package
-)
+    keywords=("utils", "robotframework", "testing", "onap"),
+    version='0.3',                          # Update the version number for new releases
+    license="Apache 2.0",
+    description='Scripts written to be used during robot framework testing',    # Info about script
+    long_description="python-package that provides convenience methods to make certain tasks in robot framework easier."
+                     "since this uses robot framework internal libraries or may in the future, it is not meant as a"
+                     "general purpose library",
+    url="https://github.com/onap/testsuite-python-testing-utils",
+    platforms=['all'],
+    install_requires=[
+        'dnspython',
+        'paramiko',
+        'pyyaml',
+        'robotframework',
+        'deepdiff>=2.5,<3.3',
+        'Jinja2'
+    ],  # what we need
+    packages=['eteutils', 'loadtest'],       # The name of your scripts package
+    package_dir={'eteutils': 'eteutils', 'loadtest': 'loadtest'}, # The location of your scipts package
+    classifiers=[
+        'Development Status :: 4 - Beta',
+        'Intended Audience :: Developers',
+        'Programming Language :: Python :: 2.7',
+        'Environment :: Plugins',
+        'Framework :: Robot Framework',
+        'Framework :: Robot Framework :: Library',
+        'License :: OSI Approved :: Apache Software License'
+    ]
+)
\ No newline at end of file