diff options
Diffstat (limited to 'g_common/g_common.py')
-rw-r--r-- | g_common/g_common.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/g_common/g_common.py b/g_common/g_common.py index e7c8ca1..c1df781 100644 --- a/g_common/g_common.py +++ b/g_common/g_common.py @@ -139,12 +139,14 @@ def generate_tree(repo_location,generate_manifest,generate_metadata): metadata_file.close() #write repo metadata if not os.path.exists(os.path.join(repo_location,'profiles','repo_name')): + import string #make up a name #as a lucky guess, use the last part of the repo_location directory location repo_location_parts=os.path.split(repo_location) if len(repo_location_parts): #repo might be locaten in /... unlikely, but i was in a good mood while typing this + #name chars must be in [a-zA-Z_-] and must not start with a - raw_name=repo_location_parts[-1] - name=''.join([x for x in raw_name if x.isalnum() or x=='_' or x=='-']) #hope that there won't be any utf8 issues + name=''.join([x for x in raw_name if x in string.ascii_letters+string.digits or x=='_' or x=='-']) if name[0]=='-': #name may not begin with a hyphen name=name[1:] else: |