def ensure_built(self): self._virtualenv = hitchbuildpy.VirtualenvBuild( name="py{0}".format("3.7.0"), base_python=hitchbuildpy.PyenvBuild("3.7.0").with_build_path( self._paths.share), ).with_packages("ipython", "q").with_build_path(self._paths.gen) self._virtualenv.ensure_built()
def project_build(paths, python_version): pylibrary = (hitchbuildpy.PyLibrary( name="py{0}".format(python_version), base_python=hitchbuildpy.PyenvBuild(python_version).with_build_path( paths.share), module_name="hitchbuildpg", library_src=paths.project, ).with_requirementstxt(paths.key / "debugrequirements.txt").with_build_path(paths.gen)) pylibrary.ensure_built() return pylibrary
def set_up(self): virtualenv = (hitchbuildpy.VirtualenvBuild( self.path.gen / "venv", hitchbuildpy.PyenvBuild(self.path.share / "python3.7.0", "3.7.0"), ).with_requirementstxt("requirements.txt")) virtualenv.ensure_built() self.example_py_code = (ExamplePythonCode( virtualenv.bin.python, self.path.gen).with_setup_code( self.given.get("setup", "")).with_terminal_size( 160, 100).with_strings(state=self.given["state"]).with_modules( "game.py", "state.py"))
def project_build(project_name, paths, python_version, libraries=None): pylibrary = hitchbuildpy.VirtualenvBuild( base_python=hitchbuildpy.PyenvBuild( paths.share / "python{}".format(python_version), python_version), ).with_requirementstxt(paths.key / "debugrequirements.txt") if libraries is not None: for library_name, library_version in libraries.items(): pylibrary = pylibrary.with_packages("{0}=={1}".format( library_name, library_version)) pylibrary.ensure_built() return pylibrary
def set_up(self): """Set up your applications and the test environment.""" self.path.state = self.path.gen.joinpath("state") if self.path.state.exists(): self.path.state.rmtree(ignore_errors=True) self.path.state.mkdir() if self.path.gen.joinpath("q").exists(): self.path.gen.joinpath("q").remove() for filename, text in self.given.get("files", {}).items(): filepath = self.path.state.joinpath(filename) if not filepath.dirname().exists(): filepath.dirname().makedirs() filepath.write_text(text) for filename, linkto in self.given.get("symlinks", {}).items(): filepath = self.path.state.joinpath(filename) linktopath = self.path.state.joinpath(linkto) linktopath.symlink(filepath) for filename, permission in self.given.get("permissions", {}).items(): filepath = self.path.state.joinpath(filename) filepath.chmod(int(permission, 8)) pylibrary = hitchbuildpy.PyLibrary( name="py3.5.0", base_python=hitchbuildpy.PyenvBuild("3.5.0").with_build_path( self.path.share), module_name="pathquery", library_src=self.path.project, ).with_build_path(self.path.gen) pylibrary.ensure_built() self.python = pylibrary.bin.python self.example_py_code = ExamplePythonCode(self.python, self.path.state)\ .with_code(self.given.get('code', ''))\ .with_setup_code(self.given.get('setup', ''))\ .with_terminal_size(160, 100)\ .with_env(TMPDIR=self.path.gen)\ .with_long_strings( yaml_snippet_1=self.given.get('yaml_snippet_1'), yaml_snippet=self.given.get('yaml_snippet'), yaml_snippet_2=self.given.get('yaml_snippet_2'), modified_yaml_snippet=self.given.get('modified_yaml_snippet'), )
def project_build(paths, python_version, selenium_version=None): pylibrary = (hitchbuildpy.PyLibrary( name="py{0}".format(python_version), base_python=hitchbuildpy.PyenvBuild(python_version).with_build_path( paths.share), module_name="seleniumdirector", library_src=paths.project, ).with_requirementstxt(paths.key / "debugrequirements.txt").with_build_path(paths.gen)) if selenium_version is not None: pylibrary = pylibrary.with_packages( "selenium=={0}".format(selenium_version)) pylibrary.ensure_built() return pylibrary
def project_build(paths, python_version, ruamel_version=None): pylibrary = hitchbuildpy.PyLibrary( name="py{0}".format(python_version), base_python=hitchbuildpy.PyenvBuild(python_version).with_build_path( paths.share), module_name="strictyaml", library_src=paths.project, ).with_requirementstxt(paths.key / "debugrequirements.txt").with_build_path(paths.gen) if ruamel_version is not None: pylibrary = pylibrary.with_packages( "ruamel.yaml=={0}".format(ruamel_version)) pylibrary.ensure_built() return pylibrary
def pyenv(self): return hitchbuildpy.PyenvBuild( self._paths.share / "python{}".format(self._python_version), self._python_version, )