tree.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:ave 作者: sonyxperiadev 项目源码 文件源码
def check_job_path(jobs_dir, job):
    if 'path' not in job:
        raise Exception('job does not have the "path" attribute: %s' % job)
    if not isinstance(job['path'], basestring):
        raise Exception('"path" attribute is not a string: %s' % job)
    # check that 'path' is rooted in the same directory as the .vcsjob file
    if job['path'].startswith('/'):
        raise Exception('job path is not relative: %s' % job['path'])
    path = os.path.normpath(os.path.join(jobs_dir, job['path']))
    if not path.startswith(jobs_dir):
        raise Exception('job path is not inside the job tree: %s' % path)
    # also check that the job exists and is runnable
    if not os.path.isfile(path):
        raise Exception('no such file: %s' % path)
    if not os.access(path, os.X_OK):
        raise Exception('file is not executable: %s' % path)
    if 'profiles' not in job:
        job['profiles'] = None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号