Пример #1
0
def deploy(version):
    """
    Deploy to pypi as specified version.
    """
    NAME = "strictyaml"
    git = Command("git").in_dir(DIR.project)
    version_file = DIR.project.joinpath("VERSION")
    old_version = version_file.bytes().decode('utf8')
    if version_file.bytes().decode("utf8") != version:
        DIR.project.joinpath("VERSION").write_text(version)
        git("add", "VERSION").run()
        git("commit", "-m", "RELEASE: Version {0} -> {1}".format(
            old_version,
            version
        )).run()
        git("push").run()
        git("tag", "-a", version, "-m", "Version {0}".format(version)).run()
        git("push", "origin", version).run()
    else:
        git("push").run()

    # Set __version__ variable in __init__.py, build sdist and put it back
    initpy = DIR.project.joinpath(NAME, "__init__.py")
    original_initpy_contents = initpy.bytes().decode('utf8')
    initpy.write_text(
        original_initpy_contents.replace("DEVELOPMENT_VERSION", version)
    )
    python("setup.py", "sdist").in_dir(DIR.project).run()
    initpy.write_text(original_initpy_contents)

    # Upload to pypi
    python(
        "-m", "twine", "upload", "dist/{0}-{1}.tar.gz".format(NAME, version)
    ).in_dir(DIR.project).run()
Пример #2
0
def deploy(version):
    """
    Deploy to pypi as specified version.
    """
    NAME = "strictyaml"
    git = Command("git").in_dir(DIR.project)
    version_file = DIR.project.joinpath("VERSION")
    old_version = version_file.bytes().decode('utf8')
    if version_file.bytes().decode("utf8") != version:
        DIR.project.joinpath("VERSION").write_text(version)
        git("add", "VERSION").run()
        git("commit", "-m",
            "RELEASE: Version {0} -> {1}".format(old_version, version)).run()
        git("push").run()
        git("tag", "-a", version, "-m", "Version {0}".format(version)).run()
        git("push", "origin", version).run()
    else:
        git("push").run()

    # Set __version__ variable in __init__.py, build sdist and put it back
    initpy = DIR.project.joinpath(NAME, "__init__.py")
    original_initpy_contents = initpy.bytes().decode('utf8')
    initpy.write_text(
        original_initpy_contents.replace("DEVELOPMENT_VERSION", version))
    python("setup.py", "sdist").in_dir(DIR.project).run()
    initpy.write_text(original_initpy_contents)

    # Upload to pypi
    python("-m", "twine", "upload",
           "dist/{0}-{1}.tar.gz".format(NAME,
                                        version)).in_dir(DIR.project).run()
Пример #3
0
def deploy(project_path, name, version):
    git = Command("git").in_dir(project_path)
    version_file = project_path.joinpath("VERSION")
    old_version = version_file.bytes().decode("utf8")
    if version_file.bytes().decode("utf8") != version:
        project_path.joinpath("VERSION").write_text(version)
        git("add", "VERSION").run()
        git("commit", "-m",
            "RELEASE: Version {0} -> {1}".format(old_version, version)).run()
        git("push").run()
        git("tag", "-a", version, "-m", "Version {0}".format(version)).run()
        git("push", "origin", version).run()
    else:
        git("push").run()

    # Set __version__ variable in __init__.py, build sdist and put it back
    initpy = project_path.joinpath(name, "__init__.py")
    original_initpy_contents = initpy.bytes().decode("utf8")
    initpy.write_text(
        original_initpy_contents.replace("DEVELOPMENT_VERSION", version))
    python("setup.py", "sdist").in_dir(project_path).run()
    initpy.write_text(original_initpy_contents)

    # Upload to pypi
    python("-m", "twine", "upload",
           "dist/{0}-{1}.tar.gz".format(name,
                                        version)).in_dir(project_path).run()
Пример #4
0
def runcommand():
    """
    Run python 3 code with the hk virtualenv.
    """
    python("pythoncode.py").run(
    )  # run python code using this project's virtualenv
    python_bin.python("pythoncode.py").run()  # equivalent
Пример #5
0
def lint():
    """
    Lint all code.
    """
    python("-m", "flake8")(
        DIR.project.joinpath("hitchbuildpg"),
        "--max-line-length=100",
        "--exclude=__init__.py",
    ).run()
    python("-m", "flake8")(DIR.key.joinpath("key.py"), "--max-line-length=100",
                           "--exclude=__init__.py").run()
    print("Lint success!")
Пример #6
0
def lint():
    """
    Lint all code.
    """
    python("-m", "flake8")(
        DIR.project.joinpath("strictyaml"),
        "--max-line-length=100",
        "--exclude=__init__.py",
    ).run()
    python("-m", "flake8")(
        DIR.key.joinpath("key.py"),
        "--max-line-length=100",
        "--exclude=__init__.py",
    ).run()
    print("Lint success!")
Пример #7
0
def deploy(version):
    """
    Deploy to pypi as specified version.
    """
    version_file = KEYPATH.parent.joinpath("VERSION")
    if version_file.bytes().decode("utf8") != version:
        KEYPATH.parent.joinpath("VERSION").write_text(version)
        git("add", "VERSION").run()
        git("commit", "-m", "RELEASE: Version {0}".format(version)).run()
        git("push").run()
        git("tag", "-a", version, "-m", "Version {0}".format(version)).run()
        git("push", "origin", version).run()
    else:
        git("push").run()
    python("setup.py", "sdist", "upload").in_dir(KEYPATH.parent).run()
Пример #8
0
def lint():
    """
    Lint all code.
    """
    python("-m", "flake8")(
        KEYPATH.parent.joinpath("usy.py"),
        "--max-line-length=100",
        "--exclude=__init__.py",
    ).run()
    python("-m", "flake8")(
        KEYPATH.joinpath("key.py"),
        "--max-line-length=100",
        "--exclude=__init__.py",
    ).run()
    print("Lint success!")
Пример #9
0
    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()

        self.path.profile = self.path.gen.joinpath("profile")
        dirtemplate.DirTemplate(
            "webapp", self.path.key / "htmltemplate", self.path.state
        ).with_vars(javascript=self.given.get("javascript", "")).with_files(
            base_html={
                filename: {
                    "content": content
                }
                for filename, content in self.given.get("website", {}).items()
            }).ensure_built()

        self.path.state.joinpath("selectors.yml").write_text(
            self.given["selectors.yml"])

        self.server = (python("-m", "http.server").in_dir(self.path.state /
                                                          "webapp").pexpect())
        self.server.expect("Serving HTTP on 0.0.0.0")

        if not self.path.profile.exists():
            self.path.profile.mkdir()

        self.python = project_build(self.path, self.given["python version"],
                                    self.given["selenium version"]).bin.python

        self.example_py_code = (ExamplePythonCode(
            self.python,
            self.path.state).with_setup_code(self.given.get(
                "setup", "")).with_terminal_size(160, 100).with_long_strings())
Пример #10
0
 def lint(self, exclude=None):
     try:
         if exclude is None:
             exclude = "__init__.py"
         python("-m", "flake8")(
             self._path.project.joinpath(self._project_name),
             "--max-line-length=100",
             "--exclude={}".format(",".join(exclude)),
             "--ignore=E203,W503",  # Ignore list[expression1 : expression2] failures
         ).run()
         python("-m", "flake8")(
             self._path.project.joinpath("hitch", "key.py"),
             "--max-line-length=100",
             "--ignore=E203,W503",
         ).run()
     except CommandError:
         raise ToolkitError("Linter failed")
Пример #11
0
def lint():
    """
    Lint all code.
    """
    python("-m", "flake8")(
        DIR.project.joinpath("seleniumdirector"),
        "--max-line-length=100",
        "--exclude=__init__.py",
    ).run()
    """
    python("-m", "flake8")(
        DIR.key.joinpath("key.py"),
        "--max-line-length=100",
        "--exclude=__init__.py",
    ).run()
    """
    print("Lint success!")
Пример #12
0
    def pushdeploy(self):
        """Push a new deployment to pypi."""
        git = Command("git").in_dir(self._path.project)
        version = self._path.project.joinpath("VERSION").text().rstrip()
        git("push", "--follow-tags").run()

        # Set __version__ variable in __init__.py, build sdist and put it back
        initpy = self._path.project.joinpath(self._project_name, "__init__.py")
        original_initpy_contents = initpy.bytes().decode("utf8")
        initpy.write_text(
            original_initpy_contents.replace("DEVELOPMENT_VERSION", version))
        python("setup.py", "sdist").in_dir(self._path.project).run()
        initpy.write_text(original_initpy_contents)

        # Upload to pypi
        python(
            "-m",
            "twine",
            "upload",
            "dist/{0}-{1}.tar.gz".format(self._project_name, version),
        ).in_dir(self._path.project).run()
Пример #13
0
def runserver():
    """
    Run web server.
    """
    python("-m", "http.server").in_dir(DIR.gen / "state" / "webapp").run()