From 47fbfbe209e1d1c484f6a80a5be957a8db811a92 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 24 Dec 2012 00:27:47 +0100 Subject: [PATCH] check configuration token when target is set --- buildozer/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 53bb553..20f897a 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -17,6 +17,7 @@ import zipfile import sys import fcntl import os +import re from select import select from sys import stdout, stderr, exit from urllib import urlretrieve @@ -58,8 +59,6 @@ class Buildozer(object): except: pass - self.check_configuration_tokens() - self.targetname = None self.target = None if target: @@ -73,6 +72,7 @@ class Buildozer(object): fromlist=['buildozer']) self.target = m.get_target(self) self.check_build_layout() + self.check_configuration_tokens() self.target.check_configuration_tokens() def prepare_for_build(self): @@ -418,6 +418,12 @@ class Buildozer(object): self.debug('Copy {0}'.format(sfn)) copyfile(sfn, rfn) + def namify(self, name): + '''Return a "valid" name from a name with lot of invalid chars + (allowed characters: a-z, A-Z, 0-9, -, _) + ''' + return re.sub('[^a-zA-Z0-9_\-]', '_', name) + @property def buildozer_dir(self): return realpath(join(