makefile and docstrings
This commit is contained in:
parent
f379a0fc0a
commit
7dd9394b84
4 changed files with 93 additions and 78 deletions
27
Makefile
27
Makefile
|
@ -15,8 +15,16 @@ ifneq ($(DESTDIR),)
|
|||
PYTHON_OPTS += --root $(DESTDIR)
|
||||
endif
|
||||
|
||||
VERSION := 1.0rc
|
||||
VERSION_FILE := version.in
|
||||
VERSION := `cat VERSION`
|
||||
|
||||
define gettext
|
||||
if command -v pygettext >/dev/null 2>&1 ; then \
|
||||
P="pygettext" ; \
|
||||
else \
|
||||
P="pygettext.py" ; \
|
||||
fi ; \
|
||||
$$P -p translations/ -o $(PACKAGE).pot `find $(PACKAGE)/ -name "*.py"`
|
||||
endef
|
||||
|
||||
# Build translation files
|
||||
define build_translation
|
||||
|
@ -27,6 +35,8 @@ define build_translation
|
|||
fi
|
||||
endef
|
||||
|
||||
|
||||
|
||||
# Install Traduction
|
||||
define install_translation
|
||||
if [ -d ${1} ]; then \
|
||||
|
@ -43,15 +53,15 @@ all: build-lang
|
|||
clean:
|
||||
$(RM) -r build
|
||||
$(RM) -r $(PACKAGE).egg-info/
|
||||
$(RM) -r $(VERSION_FILE)
|
||||
$(RM) -r $(TRADUC_DIR)/*/*.mo
|
||||
|
||||
#test: clean
|
||||
# py.test
|
||||
|
||||
# Build or update Portable Object Base Translation for gettext
|
||||
|
||||
build-pot:
|
||||
pygettext.py -p translations/ -o $(PACKAGE).pot `find $(PACKAGE)/ -name "*.py"`
|
||||
$(call gettext)
|
||||
|
||||
build-lang:
|
||||
$(call build_translation, $(TRADUC_DIR))
|
||||
|
@ -60,14 +70,11 @@ install-lang:
|
|||
$(INSTALL_DIR) $(TRADUC_DEST)
|
||||
$(call install_translation, $(TRADUC_DIR))
|
||||
|
||||
install: version.in install-lang
|
||||
install: install-lang
|
||||
python setup.py install --no-compile $(PYTHON_OPTS)
|
||||
|
||||
# List in .PHONY to force generation at each call
|
||||
version.in:
|
||||
echo -n $(VERSION) > $(VERSION_FILE)
|
||||
|
||||
dist:
|
||||
git archive --format=tar --prefix $(PACKAGE)-$(VERSION)/ HEAD | gzip -9 > $(PACKAGE)-$(VERSION).tar.gz
|
||||
|
||||
.PHONY: all clean build-pot build-lang install-lang install version.in dist
|
||||
# List in .PHONY to force generation at each call
|
||||
.PHONY: all clean build-pot build-lang install-lang install dist
|
||||
|
|
11
setup.py
11
setup.py
|
@ -1,19 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from distutils.core import setup
|
||||
from os.path import isfile
|
||||
|
||||
|
||||
version_file = 'version.in'
|
||||
|
||||
|
||||
def fetch_version():
|
||||
"""Get version from version.in"""
|
||||
|
||||
if not isfile(version_file):
|
||||
raise Exception('Please use "make && make" install instead of '
|
||||
'setup.py directly')
|
||||
return file(version_file).readline().strip()
|
||||
return file('VERSION', 'r').readline().strip()
|
||||
|
||||
|
||||
setup(
|
||||
|
@ -26,6 +18,7 @@ setup(
|
|||
packages=['tiramisu'],
|
||||
classifiers=[
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Development Status :: 4 - Beta",
|
||||
"Environment :: Other Environment",
|
||||
|
|
|
@ -92,9 +92,21 @@ class BaseInformation(object):
|
|||
|
||||
|
||||
class BaseOption(BaseInformation):
|
||||
"""This abstract base class stands for attribute access
|
||||
in options that have to be set only once, it is of course done in the
|
||||
__setattr__ method
|
||||
"""
|
||||
__slots__ = ('_readonly',)
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
"""set once and only once some attributes in the option,
|
||||
like `_name`. `_name` cannot be changed one the option and
|
||||
pushed in the :class:`tiramisu.option.OptionDescription`.
|
||||
|
||||
if the attribute `_readonly` is set to `True`, the option is
|
||||
"frozen" (which has noting to do with the high level "freeze"
|
||||
propertie or "read_only" property)
|
||||
"""
|
||||
is_readonly = False
|
||||
# never change _name
|
||||
if name == '_name':
|
||||
|
@ -102,7 +114,7 @@ class BaseOption(BaseInformation):
|
|||
self._name
|
||||
#so _name is already set
|
||||
is_readonly = True
|
||||
except:
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
if self._readonly is True:
|
||||
|
@ -988,6 +1000,9 @@ class OptionDescription(BaseOption):
|
|||
return value
|
||||
|
||||
def impl_export(self, descr=None):
|
||||
"""enables us to export into a dict
|
||||
:param descr: parent :class:`tiramisu.option.OptionDescription`
|
||||
"""
|
||||
if descr is None:
|
||||
descr = self
|
||||
export = super(OptionDescription, self).impl_export(descr)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2013-08-31 09:52+CEST\n"
|
||||
"POT-Creation-Date: 2013-09-02 11:30+CEST\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -75,231 +75,231 @@ msgstr ""
|
|||
msgid "'{0}' ({1}) object attribute '{2}' is read-only"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:159
|
||||
#: tiramisu/option.py:208
|
||||
msgid "invalid name: {0} for option"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:169
|
||||
#: tiramisu/option.py:218
|
||||
msgid "validator must be a function"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:176
|
||||
#: tiramisu/option.py:225
|
||||
msgid "a default_multi is set whereas multi is False in option: {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:182
|
||||
#: tiramisu/option.py:231
|
||||
msgid "invalid default_multi value {0} for option {1}: {2}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:187
|
||||
#: tiramisu/option.py:236
|
||||
msgid "default value not allowed if option: {0} is calculated"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:190
|
||||
#: tiramisu/option.py:239
|
||||
msgid "params defined for a callback function but no callback defined yet for option {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:212 tiramisu/option.py:753
|
||||
#: tiramisu/option.py:261 tiramisu/option.py:809
|
||||
msgid "invalid properties type {0} for {1}, must be a tuple"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:285
|
||||
#: tiramisu/option.py:334
|
||||
msgid "invalid value {0} for option {1} for object {2}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:293 tiramisu/value.py:468
|
||||
#: tiramisu/option.py:342 tiramisu/value.py:468
|
||||
msgid "invalid value {0} for option {1}: {2}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:305
|
||||
#: tiramisu/option.py:354
|
||||
msgid "invalid value {0} for option {1} which must be a list"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:374
|
||||
#: tiramisu/option.py:423
|
||||
msgid "invalid value {0} for option {1} must be different as {2} option"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:396
|
||||
#: tiramisu/option.py:445
|
||||
msgid "values must be a tuple for {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:399
|
||||
#: tiramisu/option.py:448
|
||||
msgid "open_values must be a boolean for {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:420
|
||||
#: tiramisu/option.py:469
|
||||
msgid "value {0} is not permitted, only {1} is allowed"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:432
|
||||
#: tiramisu/option.py:481
|
||||
msgid "value must be a boolean"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:442
|
||||
#: tiramisu/option.py:491
|
||||
msgid "value must be an integer"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:452
|
||||
#: tiramisu/option.py:501
|
||||
msgid "value must be a float"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:462
|
||||
#: tiramisu/option.py:511
|
||||
msgid "value must be a string, not {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:480
|
||||
#: tiramisu/option.py:529
|
||||
msgid "value must be an unicode"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:490
|
||||
#: tiramisu/option.py:539
|
||||
msgid "malformed symlinkoption must be an option for symlink {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:526
|
||||
#: tiramisu/option.py:581
|
||||
msgid "IP mustn't not be in reserved class"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:528
|
||||
#: tiramisu/option.py:583
|
||||
msgid "IP must be in private class"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:566
|
||||
#: tiramisu/option.py:621
|
||||
msgid "inconsistency in allowed range"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:571
|
||||
#: tiramisu/option.py:626
|
||||
msgid "max value is empty"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:608
|
||||
#: tiramisu/option.py:663
|
||||
msgid "network mustn't not be in reserved class"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:640
|
||||
#: tiramisu/option.py:695
|
||||
msgid "invalid network {0} ({1}) with netmask {2} ({3}), this network is an IP"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:645
|
||||
#: tiramisu/option.py:700
|
||||
msgid "invalid IP {0} ({1}) with netmask {2} ({3}), this IP is a network"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:650
|
||||
#: tiramisu/option.py:705
|
||||
msgid "invalid IP {0} ({1}) with netmask {2} ({3})"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:652
|
||||
#: tiramisu/option.py:707
|
||||
msgid "invalid network {0} ({1}) with netmask {2} ({3})"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:672
|
||||
#: tiramisu/option.py:727
|
||||
msgid "unknown type_ {0} for hostname"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:675
|
||||
#: tiramisu/option.py:730
|
||||
msgid "allow_ip must be a boolean"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:704
|
||||
#: tiramisu/option.py:759
|
||||
msgid "invalid value for {0}, must have dot"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:707
|
||||
#: tiramisu/option.py:762
|
||||
msgid "invalid domainname's length for {0} (max {1})"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:710
|
||||
#: tiramisu/option.py:765
|
||||
msgid "invalid domainname's length for {0} (min 2)"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:714
|
||||
#: tiramisu/option.py:769
|
||||
msgid "invalid domainname"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:731
|
||||
#: tiramisu/option.py:787
|
||||
msgid "invalid name: {0} for optiondescription"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:743
|
||||
#: tiramisu/option.py:799
|
||||
msgid "duplicate option name: {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:769
|
||||
#: tiramisu/option.py:825
|
||||
msgid "unknown Option {0} in OptionDescription {1}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:820
|
||||
#: tiramisu/option.py:874
|
||||
msgid "duplicate option: {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:850
|
||||
#: tiramisu/option.py:904
|
||||
msgid "no option for path {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:856
|
||||
#: tiramisu/option.py:910
|
||||
msgid "no option {0} found"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:866
|
||||
#: tiramisu/option.py:920
|
||||
msgid "cannot change group_type if already set (old {0}, new {1})"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:879
|
||||
#: tiramisu/option.py:933
|
||||
msgid "master group {0} shall not have a subgroup"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:882
|
||||
#: tiramisu/option.py:936
|
||||
msgid "master group {0} shall not have a symlinkoption"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:885
|
||||
#: tiramisu/option.py:939
|
||||
msgid "not allowed option {0} in group {1}: this option is not a multi"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:896
|
||||
#: tiramisu/option.py:950
|
||||
msgid "master group with wrong master name for {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:905
|
||||
#: tiramisu/option.py:959
|
||||
msgid "no child has same nom has master group for: {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:908
|
||||
#: tiramisu/option.py:962
|
||||
msgid "group_type: {0} not allowed"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:946
|
||||
#: tiramisu/option.py:1021
|
||||
msgid "malformed requirements type for option: {0}, must be a dict"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:962
|
||||
#: tiramisu/option.py:1037
|
||||
msgid "malformed requirements for option: {0} require must have option, expected and action keys"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:967
|
||||
#: tiramisu/option.py:1042
|
||||
msgid "malformed requirements for option: {0} inverse must be boolean"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:971
|
||||
#: tiramisu/option.py:1046
|
||||
msgid "malformed requirements for option: {0} transitive must be boolean"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:975
|
||||
#: tiramisu/option.py:1050
|
||||
msgid "malformed requirements for option: {0} same_action must be boolean"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:979
|
||||
#: tiramisu/option.py:1054
|
||||
msgid "malformed requirements must be an option in option {0}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:982
|
||||
#: tiramisu/option.py:1057
|
||||
msgid "malformed requirements option {0} should not be a multi"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:988
|
||||
#: tiramisu/option.py:1063
|
||||
msgid "malformed requirements second argument must be valid for option {0}: {1}"
|
||||
msgstr ""
|
||||
|
||||
#: tiramisu/option.py:993
|
||||
#: tiramisu/option.py:1068
|
||||
msgid "inconsistency in action types for option: {0} action: {1}"
|
||||
msgstr ""
|
||||
|
||||
|
|
Loading…
Reference in a new issue