Skip to content
This repository has been archived by the owner on Nov 19, 2017. It is now read-only.

Commit

Permalink
Version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen van der Heijden committed Oct 19, 2016
1 parent 3fa7739 commit 2fe25c6
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 24 deletions.
64 changes: 46 additions & 18 deletions build_deb.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import shutil
import stat
import re

import argparse
from version import __version__


CHANGELOG_FILE = 'ChangeLog'

def _get_changelog(version):
with open('ChangeLog-{}'.format(version), 'r') as f:
Expand All @@ -27,21 +27,29 @@ def _get_distribution():


if __name__ == '__main__':
# Run setup.py to create executable
subprocess.call(['python3', 'setup.py', 'build'])
parser = argparse.ArgumentParser()

parser.add_argument(
'-r',
'--rev',
type=int,
default=0,
help='Debian Revision number.')

parser.add_argument(
'-f',
'--force',
action='store_true',
help='Overwrite existing build.')

# Read the current version
if __version__ is None:
exit('Cannot find version in file: {}'.format(VERSION_FILE))
args = parser.parse_args()

changelog = _get_changelog(__version__)
# Explain architecture= amd64
# The architecture is AMD64-compatible and Debian AMD64 will run on AMD and
# Intel processors with 64-bit support.
# Because of the technology paternity, Debian uses the name "AMD64".
version = __version__
if args.rev:
version += '-{}'.format(args.rev)

config = dict(
version=__version__,
version=version,
name='Jeroen van der Heijden',
email='[email protected]',
company='Transceptor Technology',
Expand All @@ -65,14 +73,34 @@ def _get_distribution():
'''.rstrip(),
explain='create and extend a SiriDB time series database',
depends='${shlibs:Depends}, '
'${misc:Depends}',
changelog=changelog.strip()
'${misc:Depends}'
)

with open(CHANGELOG_FILE, 'r') as f:
current_changelog = f.read()

if '{package} ({version})'.format(
**config) in current_changelog:
if not args.force:
raise ValueError(
'Version {} already build. Use -r <revision> to create a new '
'revision number or use -f to overwrite the existing pacakge'
.format(version))
changelog = None
else:
changelog = _get_changelog(version)
config.update(dict(
changelog=changelog.strip()
))

# Run setup.py to create executable
subprocess.call(['python3', 'setup.py', 'build'])

OVERRIDES = open(
'deb/OVERRIDES', 'r').read().strip().format(**config)
CHANGELOG = open(
'deb/CHANGELOG', 'r').read().strip().format(**config)
if changelog:
CHANGELOG = open(
'deb/CHANGELOG', 'r').read().strip().format(**config)
CONTROL = open(
'deb/CONTROL', 'r').read().strip().format(**config)
MANPAGE = open(
Expand Down Expand Up @@ -124,7 +152,7 @@ def _get_distribution():
else:
current_changelog = ''

if '{package} ({version})'.format(**config) not in current_changelog:
if changelog:
changelog = CHANGELOG + '\n\n' + current_changelog

with open(changelog_file, 'w') as f:
Expand Down
17 changes: 12 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ def parse_create_replica_or_pool(args):
'-l', '--log-level',
default='info',
help='set the log level (ignored in wizard mode)',
choices=['debug', 'info', 'warning', 'error', 'critical'])
choices=['debug', 'info'])

subparsers = parser.add_subparsers(
dest='action',
Expand Down Expand Up @@ -1062,18 +1062,25 @@ def parse_create_replica_or_pool(args):

args = parser.parse_args()

formatter = logging.Formatter(fmt='%(message)s', style='%')

logger = logging.getLogger()
logger.setLevel(args.log_level.upper())

ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
ch.setFormatter(formatter)
logger.addHandler(ch)

if args.version:
quit_manage(0, '''
SiriDB {version} manage tool
SiriDB Manage {version}
Maintainer: {maintainer} <{email}>
Home-page: http://siridb.net
'''.strip().format(version=__version__,
maintainer=__maintainer__,
email=__email__))

logger = logging.getLogger()
logger.setLevel(args.log_level.upper())

# Check for root
if not args.noroot and not os.geteuid() == 0:
quit_manage(2,
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version_info__ = (2, 0, 0)
__version__ = '.'.join(map(str, __version_info__))
__maintainer__ = 'Jeroen van der Heijden'
__email__ = '[email protected]'
__email__ = '[email protected]'

0 comments on commit 2fe25c6

Please sign in to comment.