Commit cad199c7 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Improved packaging

- Improved automatic version tagging from git repo.
- Added auto generated synnefo.<package>.version module to contain each
  package version.
parent 945f866d
......@@ -40,18 +40,20 @@ import os
from distutils.util import convert_path
from fnmatch import fnmatchcase
from setuptools import setup, find_packages
from synnefo.version import vcs_version
from synnefo.util.version import update_version
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
update_version('synnefo.versions', 'app', HERE)
from synnefo.versions.app import __version__
# Package info
VERSION = vcs_version()
VERSION = __version__
README = open(os.path.join(HERE, 'README')).read()
CHANGES = open(os.path.join(HERE, 'Changelog')).read()
SHORT_DESCRIPTION = 'Package short description'
PACKAGES_ROOT = '.'
PACKAGES = find_packages(PACKAGES_ROOT, exclude=['okeanos_site'])
PACKAGES = find_packages(PACKAGES_ROOT)
# Package meta
CLASSIFIERS = []
......@@ -184,6 +186,7 @@ setup(
maintainer = 'Package maintainer',
maintainer_email = 'maintainer@grnet.gr',
namespace_packages = ['synnefo', 'synnefo.versions'],
packages = PACKAGES,
package_dir= {'': PACKAGES_ROOT},
include_package_data = True,
......@@ -209,5 +212,5 @@ setup(
'urls = synnefo.app_settings.urls:urlpatterns',
]
},
)
)
......@@ -3,7 +3,8 @@
# API configuration
#####################
from deploy import *
# Top-level URL for deployment. Numerous other URLs depend on this.
APP_INSTALL_URL = "https://host:port"
# The API implementation needs to accept and return absolute references
# to its resources. Thus, it needs to know its public URL.
......
......@@ -46,9 +46,9 @@ from django.core.urlresolvers import reverse
from django.core.mail import send_mail
from django.http import Http404
from synnefo.version import get_dist_version
from synnefo.util.version import get_component_version
SYNNEFO_JS_LIB_VERSION = get_dist_version('snf-app')
SYNNEFO_JS_LIB_VERSION = get_component_version('app')
IMAGE_ICONS = settings.IMAGE_ICONS
LOGOUT_URL = getattr(settings, "LOGOUT_URL", settings.LOGIN_URL)
INVITATIONS_PER_PAGE = getattr(settings, "INVITATIONS_PER_PAGE", 10)
......
# Copyright 2011 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and
# documentation are those of the authors and should not be
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
__version__ = "0.7.3-291-g5832c79"
__version_info__ = __version__.split(".")
\ No newline at end of file
include README Changelog
include distribute_setup.py
......@@ -40,12 +40,14 @@ import os
from distutils.util import convert_path
from fnmatch import fnmatchcase
from setuptools import setup, find_packages
from synnefo.version import vcs_version
from synnefo.util.version import update_version
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
update_version('synnefo.versions', 'common', HERE)
from synnefo.versions.common import __version__
# Package info
VERSION = vcs_version()
VERSION = __version__
README = open(os.path.join(HERE, 'README')).read()
CHANGES = open(os.path.join(HERE, 'Changelog')).read()
SHORT_DESCRIPTION = 'Package short description'
......@@ -80,6 +82,7 @@ setup(
maintainer = 'Package maintainer',
maintainer_email = 'maintainer@grnet.gr',
namespace_packages = ['synnefo', 'synnefo.versions'],
packages = PACKAGES,
package_dir= {'': PACKAGES_ROOT},
include_package_data = True,
......
import pkg_resources
import os
def get_dist_from_module(modname):
pkgroot = pkg_resources.get_provider(modname).egg_root
return list(pkg_resources.find_distributions(pkgroot))[0]
def get_dist(dist_name):
return pkg_resources.get_distribution(dist_name)
def get_dist_version(dist_name):
"""
Get the version for the specified distribution name
"""
try:
return get_dist(dist_name).version
except Exception, e:
return 'unknown'
def get_component_version(modname):
"""
Return the version of a synnefo module/package based on its
corresponding distributed package version
"""
try:
version = vcs_version()
if not version:
version = __import__('synnefo.versions.%s' % modname,
fromlist=['synnefo.versions']).__version__
return version
except Exception, e:
return 'unknown'
def vcs_info():
"""
Return current git HEAD commit information
"""
import subprocess
callgit = lambda(cmd): subprocess.Popen(
['/bin/sh', '-c', cmd],
stdout=subprocess.PIPE).communicate()[0].strip()
branch = callgit('git branch | grep -Ei "\* (.*)" | cut -f2 -d" "')
revid = callgit("git --no-pager log --max-count=1 | cut -f2 -d' ' | head -1")
revno = callgit('git --no-pager log --oneline | wc -l')
desc = callgit('git describe')
return branch, revid, revno, desc
def vcs_version():
"""
Package version based on `git describe`, compatible with setuptools
version format
"""
return vcs_info()[3].lstrip('v')
def update_version(module, name='version', root="."):
"""
Helper util to generate/replace a version.py file containing version
information retrieved from vcs_version as a submodule of passed `module`
"""
# exit early if not in development environment
if not os.path.exists(os.path.join(root, '..', '.git')):
return
paths = [root] + module.split(".") + ["%s.py" % name]
module_filename = os.path.join(*paths)
content = """
__version__ = "%(version)s"
__version_info__ = __version__.split(".")
""" % dict(version=vcs_version())
module_file = file(module_filename, "w+")
module_file.write(content)
module_file.close()
import pkg_resources
def get_dist_from_module(modname):
pkgroot = pkg_resources.get_provider(modname).egg_root
return list(pkg_resources.find_distributions(pkgroot))[0]
def get_dist(dist_name):
return pkg_resources.get_distribution(dist_name)
def get_dist_version(dist_name):
"""
Get the version for the specified distribution name
"""
try:
return get_dist(dist_name).version
except Exception, e:
return 'unknown'
def get_component_version(modname):
"""
Return the version of a synnefo module/package based on its
corresponding distributed package version
"""
try:
return get_dist_from_module(modname).version
except Exception, e:
return 'unknown'
def vcs_info():
"""
Return current git HEAD commit information
"""
import subprocess
callgit = lambda(cmd): subprocess.Popen(
['/bin/sh', '-c', cmd],
stdout=subprocess.PIPE).communicate()[0].strip()
branch = callgit('git branch | grep -Ei "\* (.*)" | cut -f2 -d" "')
revid = callgit("git --no-pager log --max-count=1 | cut -f2 -d' ' | head -1")
revno = callgit('git --no-pager log --oneline | wc -l')
desc = callgit('git describe')
return branch, revid, revno, desc
def vcs_version():
"""
Package version based on `git describe`, compatible with setuptools
version format
"""
return vcs_info()[3].replace('v', '')
__version__ = "0.7.3-291-g5832c79"
__version_info__ = __version__.split(".")
\ No newline at end of file
# Copyright 2011 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and
# documentation are those of the authors and should not be
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
__version__ = "0.7.3-291-g5832c79"
__version_info__ = __version__.split(".")
\ No newline at end of file
include kvm-vif-bridge snf-ganeti-eventd.py snf-ganeti-hook.py snf-progress-monitor.py
include kvm-vif-bridge
include distribute_setup.py
#!/usr/bin/env python
import os
from setuptools import setup
from synnefo.version import vcs_version
from synnefo.util.version import update_version
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
update_version('synnefo.versions', 'ganeti', HERE)
from synnefo.versions.ganeti import __version__
setup(
name="snf-ganeti-tools",
version=vcs_version(),
version=__version__,
description="Synnefo Ganeti supplementary tools",
author="Synnefo Development Team",
author_email="synnefo@lists.grnet.gr",
license="BSD",
url="http://code.grnet.gr/projects/synnefo",
namespace_packages=["synnefo"],
packages=["synnefo", "synnefo.ganeti"],
namespace_packages=["synnefo", "synnefo.versions"],
packages=["synnefo", "synnefo.ganeti", "synnefo.versions"],
install_requires=[
'daemon',
'pyinotify',
......
# Copyright 2011 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and
# documentation are those of the authors and should not be
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
__version__ = "0.7.3-291-g5832c79"
__version_info__ = __version__.split(".")
\ No newline at end of file
__version__ = "0.7.3-291-g5832c79"
__version_info__ = __version__.split(".")
\ No newline at end of file
......@@ -3,12 +3,15 @@ distribute_setup.use_setuptools()
import os
from setuptools import setup, find_packages
from synnefo.version import vcs_version
from synnefo.util.version import update_version
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
update_version('okeanos_site', 'version', HERE)
from okeanos_site.version import __version__
# Package info
VERSION = vcs_version()
VERSION = __version__
README = open(os.path.join(HERE, 'README')).read()
CHANGES = open(os.path.join(HERE, 'Changelog')).read()
SHORT_DESCRIPTION = 'Package short description'
......
include README Changelog
include distribute_setup.py
......@@ -40,17 +40,19 @@ import os
from distutils.util import convert_path
from fnmatch import fnmatchcase
from setuptools import setup, find_packages
from synnefo.version import vcs_version
from synnefo.util.version import update_version
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
update_version('synnefo.versions', 'webproject', HERE)
from synnefo.versions.webproject import __version__
# Package info
VERSION = vcs_version()
VERSION = __version__
README = open(os.path.join(HERE, 'README')).read()
CHANGES = open(os.path.join(HERE, 'Changelog')).read()
SHORT_DESCRIPTION = 'Package short description'
PACKAGES_ROOT = '.'
PACKAGES_ROOT = "."
PACKAGES = find_packages(PACKAGES_ROOT)
# Package meta
......@@ -80,6 +82,7 @@ setup(
maintainer = 'Package maintainer',
maintainer_email = 'maintainer@grnet.gr',
namespace_packages = ['synnefo', 'synnefo.versions'],
packages = PACKAGES,
package_dir= {'': PACKAGES_ROOT},
include_package_data = True,
......
......@@ -38,3 +38,4 @@ try:
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment