def home(self, path=None, init=None): home = Home(path or self.sandbox()) makedirs(os.path.dirname(home.root)) if init is None: init = not home.db.exists if init: home.init(create_parents=True) return home
with open(tmp, 'w') as fh: for line in self.iter_dump(): fh.write(line) os.rename(tmp, path) if not recurse: return for item in self._items: if not item.is_include: continue include = item.value req_set = include.manifest sub_path = os.path.join(os.path.dirname(path), include.path) makedirs(os.path.dirname(sub_path)) paths.extend(req_set.dump(sub_path)) return paths if __name__ == '__main__': import sys from vee.home import Home manifest = Manifest(home=Home()) manifest.parse_args(sys.argv[1:]) print(''.join(manifest.iter_dump()))
def home(self): try: return self._home except AttributeError: self._home = home = Home(self.home_path) return home
# 'VEE_REPO': 'sandbox', 'VEE_HOMEBREW': sandbox('Homebrew'), 'VEE_VENDOR': os.path.join(sandbox_dir, 'Vendor'), 'PATH': '%s:%s' % (os.path.join(root_dir, 'bin'), os.environ['PATH']), } os.environ.update(_environ_diff) default_python = get_default_python() default_branch = get_default_branch() # Setup mock HTTP server. setup_mock_http(sandbox_dir) home = Home(VEE) home.init() def vee(args, environ=None, check=True, stdout=False): full_environ = os.environ.copy() full_environ.update(environ or {}) full_environ.update(_environ_diff) log.debug('$ vee ' + ' '.join(args), name='vee.tests') if stdout: cmd = ['vee'] cmd.extend(args) return subprocess.check_output(cmd, env=environ) res = _main(args, environ=full_environ) if check and res: raise ValueError('return code %d' % res) return res
if isinstance(element, Envvar): environ[element.name] = element.value if isinstance(element, Package): req = element = (element.freeze() if freeze else element.copy()) # We don't need a name if it matches the guessed version. if req.name and req.name == guess_name(req.url): req.name = None # Strip out anything in the base environment which matches. for k, v in environ.iteritems(): if req.base_environ.get(k) == v: del req.base_environ[k] yield '%s%s%s\n' % (before or '', element, after or '') if __name__ == '__main__': import sys from vee.home import Home reqs = Requirements(Home('/usr/local/vee')) reqs.parse_args(sys.argv[1:]) print ''.join(reqs.iter_dump())