def _files_glob(path, globs, trim_prefix='', realpath=False): if not path: path = '.' if realpath: path = p_realpath(path) if trim_prefix: trim_prefix = p_realpath(trim_prefix) elif trim_prefix: trim_prefix = p_normpath(trim_prefix) for globlet in globs: globresults = glob.glob(p_normpath(p_join(path, globlet))) for globresult in globresults: if trim_prefix and len(trim_prefix + _dirsep) < len(globresult) and globresult[:len(trim_prefix + _dirsep)] == trim_prefix + _dirsep: result = globresult[len(trim_prefix + _dirsep):] else: result = globresult yield unicode(result)
def _files_glob(path, globs, trim_prefix='', realpath=False): if not path: path = '.' if realpath: path = p_realpath(path) if trim_prefix: trim_prefix = p_realpath(trim_prefix) elif trim_prefix: trim_prefix = p_normpath(trim_prefix) for globlet in globs: globresults = glob.glob(p_normpath(p_join(path, globlet))) for globresult in globresults: if trim_prefix and len(trim_prefix + _dirsep) < len( globresult ) and globresult[:len(trim_prefix + _dirsep)] == trim_prefix + _dirsep: result = globresult[len(trim_prefix + _dirsep):] else: result = globresult yield unicode(result)
from distutils.dist import DistributionMetadata ## GLOBAL VARS SETUP ## _newdirsep = p_realpath('.') _dirsep = '' while _newdirsep != _dirsep: # iterate to find '/' or the system equivalent _dirsep = _newdirsep _newdirsep = p_dirname(_dirsep) _dirsep = p_splitdrive(_dirsep)[1] del _newdirsep _projectpath = p_realpath('.') _configvars = sysconfig.get_config_vars() _configpaths = sysconfig.get_paths() if p_basename(_configpaths['data']) == 'usr': #GOTCHA: '[path]/usr', not only '/usr', to allow for virtualenvs... _configprefix = p_normpath(p_join(_configpaths['data'], p_pardir, 'etc')) # "[path]/usr" => "[path]/etc" ("[path]/usr/etc", FHS-friendly) else: _configprefix = p_join(_configpaths['data'], 'etc') # "[path]/[something_else]" => "[path]/[something_else]/etc" _dirsep, _projectpath, _configprefix = unicode(_dirsep), unicode(_projectpath), unicode(_configprefix) ## TO EDIT ## project = { 'description': 'Async server micro-framework for control freaks', 'hosttype': 'github', 'repotype': 'git', 'username': '******', 'author': 'Rowan Thorpe', 'author_email': '*****@*****.**', 'classifiers': [ 'Development Status :: 3 - Alpha',
_newdirsep = p_realpath('.') _dirsep = '' while _newdirsep != _dirsep: # iterate to find '/' or the system equivalent _dirsep = _newdirsep _newdirsep = p_dirname(_dirsep) _dirsep = p_splitdrive(_dirsep)[1] del _newdirsep _projectpath = p_realpath('.') _configvars = sysconfig.get_config_vars() _configpaths = sysconfig.get_paths() if p_basename( _configpaths['data'] ) == 'usr': #GOTCHA: '[path]/usr', not only '/usr', to allow for virtualenvs... _configprefix = p_normpath( p_join(_configpaths['data'], p_pardir, 'etc') ) # "[path]/usr" => "[path]/etc" ("[path]/usr/etc", FHS-friendly) else: _configprefix = p_join( _configpaths['data'], 'etc') # "[path]/[something_else]" => "[path]/[something_else]/etc" _dirsep, _projectpath, _configprefix = unicode(_dirsep), unicode( _projectpath), unicode(_configprefix) ## TO EDIT ## project = { 'description': XXXXXXX, 'hosttype': XXXXXXX,