From: tierno Date: Tue, 24 Apr 2018 08:41:10 +0000 (+0200) Subject: Package generation fixing X-Git-Tag: v4.0.0~11 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=commitdiff_plain;h=dfe0957eb800224f10ab44797d4d9e05ed7aa69a;ds=sidebyside Package generation fixing provide version using /osm/static/version Change-Id: I826d811fe52e7a0d71807dfcbad3e1cebe3a2051 Signed-off-by: tierno --- diff --git a/.gitignore-common b/.gitignore-common index 62bb57e..f0f10bd 100644 --- a/.gitignore-common +++ b/.gitignore-common @@ -19,7 +19,7 @@ logs .settings #local stuff files that end in ".local" or folders called "local" -*.local +local osm_nbi/local osm_nbi/test/local @@ -28,4 +28,8 @@ osm_nbi/test/local osm_nbi/temp osm_nbi/test/temp +#distribution and package generation +build +dist +*.egg-info diff --git a/Dockerfile b/Dockerfile index 058c506..179dfa8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,8 @@ +# This Dockerfile is intented for devops and deb package generation +# +# Use Dockerfile.local for running osm/NBI in a docker container + + FROM ubuntu:16.04 RUN apt-get update && apt-get -y install git make python python3 \ diff --git a/Makefile b/Makefile index c8fdc45..6b857ed 100644 --- a/Makefile +++ b/Makefile @@ -1,53 +1,34 @@ -.PHONY: all test clean - -SHELL := /bin/bash - -BRANCH ?= master - -all: - $(MAKE) clean_build build +# 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. + +OUT_DIR := osm_im +TREES_DIR := osm_im_trees +Q?=@ + +all: package $(MAKE) clean_build package clean: clean_build - rm -rf .build + $(Q)rm -rf build dist osm_nbi.egg-info deb deb_dist *.gz $(OUT_DIR) $(TREES_DIR) clean_build: rm -rf build find osm_nbi -name '*.pyc' -delete find osm_nbi -name '*.pyo' -delete -prepare: - mkdir -p build/ - cp tox.ini build/ - cp MANIFEST.in build/ - cp requirements.txt build/ - cp README.rst build/ - cp setup.py build/ - cp stdeb.cfg build/ - cp -r osm_nbi build/ - cp LICENSE build/osm_nbi - - -package: prepare -# apt-get install -y python-stdeb - cd build && python3 setup.py --command-packages=stdeb.command sdist_dsc # --with-python2=False - cd build/deb_dist/osm-nbi-* && dpkg-buildpackage -rfakeroot -uc -us - mkdir -p .build - cp build/deb_dist/python3-*.deb .build/ - -snap: - echo "Nothing to be done yet" - -install: package - dpkg -i .build/python-osm-nbi*.deb - cd .. && \ - OSMLIBOVIM_PATH=`python -c 'import lib_osm_openvim; print lib_osm_openvim.__path__[0]'` || FATAL "lib-osm-openvim was not properly installed" && \ - OSMNBI_PATH=`python3 -c 'import osm_nbi; print(osm_nbi.__path__[0])'` || FATAL "osm-nbi was not properly installed" && \ - service osm-nbi restart - -develop: prepare -# pip install -r requirements.txt - cd build && ./setup.py develop +package: + tox -e build test: echo "TODO" diff --git a/README.rst b/README.rst index 2d58ef0..6d3fa42 100644 --- a/README.rst +++ b/README.rst @@ -3,6 +3,5 @@ osm-nbi =========== osm-nbi is the North Bound Interface for OSM, REST client serving json/yaml -It also implements a functional html web server - +It follows ETSI SOL005 recomendations diff --git a/osm_nbi/html_public/version b/osm_nbi/html_public/version new file mode 100644 index 0000000..10340c4 --- /dev/null +++ b/osm_nbi/html_public/version @@ -0,0 +1,3 @@ +0.1.3 +Apr 2018 + diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index aa8105a..c4c61ad 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -19,7 +19,9 @@ from codecs import getreader from os import environ __author__ = "Alfonso Tierno " -__version__ = "0.3" + +# TODO consider to remove and provide version using the static version file +__version__ = "0.1.3" version_date = "Apr 2018" database_version = '1.0' @@ -396,6 +398,7 @@ class Server(object): @cherrypy.expose def version(self, *args, **kwargs): + # TODO consider to remove and provide version using the static version file global __version__, version_date try: if cherrypy.request.method != "GET": diff --git a/osm_nbi/osm-nbi.service b/osm_nbi/osm-nbi.service index beec648..52ab70b 100644 --- a/osm_nbi/osm-nbi.service +++ b/osm_nbi/osm-nbi.service @@ -2,7 +2,7 @@ Description=NBI server (OSM NBI) [Service] -ExecStart=/usr/bin/nbi -c /etc/osm/nbi.cfg --log-file=/var/log/osm/nbi.log +ExecStart=/usr/bin/nbi.py -c /etc/osm/nbi.cfg --log-file=/var/log/osm/nbi.log Restart=always [Install] diff --git a/setup.py b/setup.py index 6185b54..7cd857c 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,20 @@ #!/usr/bin/env python3 -from setuptools import setup #, find_packages +import os +from setuptools import setup +here = os.path.abspath(os.path.dirname(__file__)) _name = "osm_nbi" +VERSION = "0.1.3" +README = open(os.path.join(here, 'README.rst')).read() setup( name=_name, description='OSM North Bound Interface', + long_description=README, # version_command=('git describe --tags --long --dirty', 'pep440-git'), - version="0.1.0", + version=VERSION, + python_requires='>3.5.0', author='ETSI OSM', author_email='alfonso.tiernosepulveda@telefonica.com', maintainer='Alfonso Tierno', @@ -16,7 +22,7 @@ setup( url='https://osm.etsi.org/gitweb/?p=osm/NBI.git;a=summary', license='Apache 2.0', - packages=[_name], # find_packages(), + packages=[_name], include_package_data=True, data_files=[('/etc/osm/', ['osm_nbi/nbi.cfg']), ('/etc/systemd/system/', ['osm_nbi/osm-nbi.service']), @@ -24,11 +30,13 @@ setup( install_requires=[ 'CherryPy', 'pymongo', 'jsonschema' + # 'PyYAML', ], -# setup_requires=['setuptools-version-command'], + # setup_requires=['setuptools-version-command'], # test_suite='nose.collector', # entry_points=''' # [console_scripts] # osm=osm_nbi.nbi:nbi # ''', ) +