equal
deleted
inserted
replaced
383 return join(CW_SOFTWARE_ROOT, 'i18n') |
383 return join(CW_SOFTWARE_ROOT, 'i18n') |
384 return join(cls.shared_dir(), 'i18n') |
384 return join(cls.shared_dir(), 'i18n') |
385 |
385 |
386 @classmethod |
386 @classmethod |
387 def available_cubes(cls): |
387 def available_cubes(cls): |
|
388 import re |
388 cubes = set() |
389 cubes = set() |
389 for directory in cls.cubes_search_path(): |
390 for directory in cls.cubes_search_path(): |
390 if not exists(directory): |
391 if not exists(directory): |
391 cls.error('unexistant directory in cubes search path: %s' |
392 cls.error('unexistant directory in cubes search path: %s' |
392 % directory) |
393 % directory) |
393 continue |
394 continue |
394 for cube in os.listdir(directory): |
395 for cube in os.listdir(directory): |
395 if cube in ('CVS', '.svn', 'shared', '.hg'): |
396 if cube == 'shared': |
396 continue |
397 continue |
397 if isdir(join(directory, cube)): |
398 if not re.match('[_A-Za-z][_A-Za-z0-9]*$', cube): |
|
399 continue # skip invalid python package name |
|
400 cubedir = join(directory, cube) |
|
401 if isdir(cubedir) and exists(join(cubedir, '__init__.py')): |
398 cubes.add(cube) |
402 cubes.add(cube) |
399 return sorted(cubes) |
403 return sorted(cubes) |
400 |
404 |
401 @classmethod |
405 @classmethod |
402 def cubes_search_path(cls): |
406 def cubes_search_path(cls): |