Commit 37919bee authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Merge branch 'release-0.6' into develop

parents 442fd5d3 6c7015d8
#!/usr/bin/env sh
set -e
BUILD_NUMBER=$1
BUILDBOT_BUILD_DIR=buildpkg_debian
PACKAGES_DIR=$1
shift
......@@ -11,7 +11,7 @@ TEMP_DIR=$(mktemp -d /tmp/devflow_autopkg_XXXXXXX)
devflow-autopkg snapshot -b $TEMP_DIR $@
# MOVE the packages
mkdir -p buildpkg_debian/$BUILD_NUMBER
mv -n $TEMP_DIR/* $BUILDBOT_BUILD_DIR/$BUILD_NUMBER/
mkdir -p $PACKAGES_DIR
mv -n $TEMP_DIR/* $PACKAGES_DIR
echo "Moved packages to: $(pwd)/$BUILDBOT_BUILD_DIR/$BUILD_NUMBER"
echo "Moved packages to: $(pwd)/$PACKAGES_DIR"
"""A set of tools to ease versioning and use of git flow"""
......@@ -31,12 +31,14 @@
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
"""Helper script for automatic build of debian packages."""
import git
import os
import sys
from optparse import OptionParser
from collections import namedtuple
from sh import mktemp, cd, rm, git_dch, python
from sh import mktemp, cd, rm, git_dch # pylint: disable=E0611
from configobj import ConfigObj
from devflow import versioning
......@@ -154,7 +156,7 @@ def main():
# Load the repository
try:
original_repo = git.Repo(".")
except git.git.InvalidGitRepositoryError:
except git.InvalidGitRepositoryError:
raise RuntimeError(red("Current directory is not git repository."))
# Check that repository is clean
......@@ -214,7 +216,7 @@ def main():
print_green("The new debian version will be: '%s'" % debian_version)
# Update the version files
python("update_version.py", _out=sys.stdout)
versioning.update_version()
# Tag branch with python version
branch_tag = python_version
......
......@@ -33,6 +33,13 @@
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
"""Helper functions for automatic version computation.
This module contains helper functions for extracting information
from a Git repository, and computing the python and debian version
of the repository code.
"""
import os
import re
......@@ -40,7 +47,7 @@ import sys
import pprint
import git
from distutils import log
from distutils import log # pylint: disable=E0611
from collections import namedtuple
from configobj import ConfigObj
......@@ -90,9 +97,8 @@ def get_commit_id(commit, current_branch):
raise RuntimeError("Commit %s has more than 2 parents!" % commit)
def vcs_info():
"""
Return current git HEAD commit information.
def get_vcs_info():
"""Return current git HEAD commit information.
Returns a tuple containing
- branch name
......@@ -120,16 +126,16 @@ def vcs_info():
toplevel=toplevel)
def base_version(vcs_info):
def get_base_version(vcs_info):
"""Determine the base version from a file in the repository"""
f = open(os.path.join(vcs_info.toplevel, BASE_VERSION_FILE))
lines = [l.strip() for l in f.readlines()]
l = [l for l in lines if not l.startswith("#")]
if len(l) != 1:
lines = [l for l in lines if not l.startswith("#")]
if len(lines) != 1:
raise ValueError("File '%s' should contain a single non-comment line.")
f.close()
return l[0]
return lines[0]
def build_mode():
......@@ -404,8 +410,8 @@ def debian_version_from_python_version(pyver):
def get_python_version():
v = vcs_info()
b = base_version(v)
v = get_vcs_info()
b = get_base_version(v)
mode = build_mode()
return python_version(b, v, mode)
......@@ -416,8 +422,8 @@ def debian_version(base_version, vcs_info, mode):
def get_debian_version():
v = vcs_info()
b = base_version(v)
v = get_vcs_info()
b = get_base_version(v)
mode = build_mode()
return debian_version(b, v, mode)
......@@ -429,36 +435,39 @@ def user_info():
def update_version():
"""
This is a helper to generate/replace version files containing version
"""Generate or replace version files
Helper function for generating/replacing version files containing version
information.
"""
config = ConfigObj("devflow.conf")
v = vcs_info()
v = get_vcs_info()
if not v:
# Return early if not in development environment
raise RuntimeError("Can not compute version outside of a git"
" repository.")
b = base_version(v)
b = get_base_version(v)
mode = build_mode()
version = python_version(b, v, mode)
vcs_info_dict = v._asdict() # pylint: disable=W0212
content = """__version__ = "%(version)s"
__version_info__ = %(version_info)s
__version_vcs_info__ = %(vcs_info)s
__version_user_info__ = "%(user_info)s"
""" % dict(version=version, version_info=version.split("."),
vcs_info=pprint.PrettyPrinter().pformat(dict(v._asdict())),
vcs_info=pprint.PrettyPrinter().pformat(vcs_info_dict),
user_info=user_info())
for _pkg_name, pkg_info in config['packages'].items():
version_filename = pkg_info['version_file']
log.info("Updating version file '%s'" % version_filename)
version_file = file(version_filename, "w+")
version_file.write(content)
version_file.close()
if version_filename:
log.info("Updating version file '%s'" % version_filename)
version_file = file(version_filename, "w+")
version_file.write(content)
version_file.close()
def bump_version_main():
......@@ -472,7 +481,7 @@ def bump_version_main():
def bump_version(new_version):
"""Set new base version to base version file and commit"""
v = vcs_info()
v = get_vcs_info()
mode = build_mode()
# Check that new base version is valid
......@@ -481,7 +490,7 @@ def bump_version(new_version):
repo = git.Repo(".")
toplevel = repo.working_dir
old_version = base_version(v)
old_version = get_base_version(v)
sys.stdout.write("Current base version is '%s'\n" % old_version)
version_file = toplevel + "/version"
......@@ -504,8 +513,8 @@ def bump_version(new_version):
def main():
v = vcs_info()
b = base_version(v)
v = get_vcs_info()
b = get_base_version(v)
mode = build_mode()
try:
......
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Profiled execution.
profile=no
# Add <file or directory> to the black list. It should be a base name, not a
# path. You may set this option multiple times.
ignore=devflow/version.py
# Pickle collected data for later comparisons.
persistent=no
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
[MESSAGES CONTROL]
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time.
#enable=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifier separated by comma (,) or put this option
# multiple time.
#disable=
disable=W0511,R0922,W0201,R0922,R0801,I0011,C0111
disable-checker=similarities
[REPORTS]
# Set the output format. Available formats are text, parseable, colorized, msvs
# (visual studio) and html
output-format= colorized
# Include message's id in output
include-ids=yes
# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
# written in a file name "pylint_global.[txt|html]".
files-output=no
# Tells whether to display a full report or only the messages
reports=yes
# Python expression which should return a note less than 10 (10 is the highest
# note). You have access to the variables errors warning, statement which
# respectively contain the number of errors / warnings messages and the total
# number of statements analyzed. This is used by the global evaluation report
# (R0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Add a comment according to your evaluation note. This is used by the global
# evaluation report (R0004).
comment=yes
[TYPECHECK]
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
# List of classes names for which member attributes should not be checked
# (useful for classes with attributes dynamically set).
ignored-classes=SQLObject
# When zope mode is activated, add a predefined set of Zope acquired attributes
# to generated-members.
zope=no
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E0201 when accessed.
generated-members=REQUEST,acl_users,aq_parent
[VARIABLES]
# Tells whether we should check for unused import in __init__ files.
init-import=no
# A regular expression matching names used for dummy variables (i.e. not used).
dummy-variables-rgx=_|dummy
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
additional-builtins=
[SIMILARITIES]
# Minimum lines number of a similarity.
min-similarity-lines=4
# Ignore comments when computing similarities.
ignore-comments=yes
# Ignore docstrings when computing similarities.
ignore-docstrings=yes
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
notes=FIXME,XXX,TODO
[FORMAT]
# Maximum number of characters on a single line.
max-line-length=80
# Maximum number of lines in a module
max-module-lines=1000
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
[BASIC]
# Required attributes for module, separated by a comma
required-attributes=
# List of builtins function names that should not be used, separated by a comma
bad-functions=map,filter,apply,input
# Regular expression which should only match correct module names
module-rgx = (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Regular expression which should only match correct module level names
const-rgx = (_{0,2}([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$
# Regular expression which should only match correct class names
class-rgx = [A-Z_][a-zA-Z0-9]+$
# Regular expression which should only match correct function names
function-rgx = (_?([A-Z]+[a-z0-9]+([A-Z]+[a-z0-9]*)*)|main|([a-z_][a-z0-9_]*))$
# Regular expression which should only match correct method names
method-rgx = (_{0,2}[A-Z]+[a-z0-9]+([A-Z]+[a-z0-9]*)*|__.*__|([a-z_][a-z0-9_]*))$
# Regular expression which should only match correct instance attribute names
attr-rgx = [a-z_][a-z0-9_]{1,30}$
# Regular expression which should only match correct argument names
argument-rgx = [a-z_][a-z0-9_]*$
# Regular expression which should only match correct variable names
variable-rgx = (_?([a-z_][a-z0-9_]*)|(_?[A-Z0-9_]+))$
# Regular expression which should only match correct list comprehension /
# generator expression variable names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
# Good variable names which should always be accepted, separated by a comma
good-names=i,j,k,ex,Run,_
# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata
# Regular expression which should only match functions or classes name which do
# not require a docstring
#no-docstring-rgx = __.*__
no-docstring-rgx= .*
[DESIGN]
# Maximum number of arguments for function / method
max-args=15
# Argument names that match this expression will be ignored. Default to name
# with leading underscore
ignored-argument-names=_.*
# Maximum number of locals for function / method body
max-locals=50
# Maximum number of return / yield for function / method body
max-returns=10
# Maximum number of branch for function / method body
max-branchs=80
# Maximum number of statements in function / method body
max-statements=200
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of attributes for a class (see R0902).
max-attributes=20
# Minimum number of public methods for a class (see R0903).
min-public-methods=0
# Maximum number of public methods for a class (see R0904).
max-public-methods=50
[CLASSES]
# List of interface methods to ignore, separated by a comma. This is used for
# instance to not check methods defines in Zope's Interface base class.
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,__new__,setUp
[IMPORTS]
# Deprecated modules which should not be used, separated by a comma
deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled)
import-graph=
# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled)
ext-import-graph=
# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled)
int-import-graph=
......@@ -43,7 +43,13 @@ from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.normpath(os.path.dirname(__file__)))
from devflow.version import __version__
try:
from devflow.version import __version__
except ImportError:
# Bootstrap devflow
from devflow.versioning import update_version
update_version()
from devflow.version import __version__
# Package info
VERSION = __version__
......@@ -59,7 +65,7 @@ CLASSIFIERS = []
# Package requirements
INSTALL_REQUIRES = [
'gitpython', 'sh', 'configobj'
'gitpython', 'sh', 'configobj', 'ansicolors'
]
# Provided as an attribute, so you can append to these instead
......@@ -156,7 +162,7 @@ setup(
name='devflow',
version=VERSION,
license='BSD',
url='http://www.synnefo.ogr/',
url='http://www.synnefo.org/',
description=SHORT_DESCRIPTION,
long_description=README + '\n\n' + CHANGES,
classifiers=CLASSIFIERS,
......
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