def run(self): self.status("Removing previous builds...") self.rmdir_if_exists(os.path.join(here, "dist")) self.status("Building Source and Wheel (universal) distribution...") exit_code = build() if exit_code != 0: raise errors.DistutilsError("Build failed.") sys.exit()
def run(self): self.status("Formatting code with black...") exit_code = os.system("black .") if exit_code != 0: raise errors.DistutilsError("Formatting with black failed.") self.status("Running pytest...") exit_code = os.system("pytest") if exit_code != 0: raise errors.DistutilsError("Tests failed.") self.status("Running type-checking...") exit_code = type_check() if exit_code != 0: raise errors.DistutilsError("Type-checking failed.") self.status("Running flake8...") exit_code = os.system("flake8 --exclude .git,.venv,env,__pycache__,build,dist") if exit_code != 0: raise errors.DistutilsError(" failed.")
def run_sys_command(cmd, error_msg): """Run command in os.system(), raise if exit_code non-zero. Arguments: cmd {[type]} -- Command to run. For example: "pytest" error_msg {[type]} -- Error message to raise at failure Raises: errors.DistutilsError: Exited with non-zero exit code. """ exit_code = os.system(cmd) if exit_code != 0: raise errors.DistutilsError(error_msg)
def run(self): self.status("Removing previous builds...") self.rmdir_if_exists(os.path.join(here, "dist")) self.status("Building Source and Wheel (universal) distribution...") exit_code = build() if exit_code != 0: raise errors.DistutilsError("Build failed.") self.status("Uploading the package to PyPI via Twine...") os.system("twine upload dist/*") self.status("Pushing git tags...") os.system("git tag v{about}".format(about=VERSION)) os.system("git push --tags") sys.exit()
def run(self): exit_code = type_check() self.status( "Typecheck exited with code: {code}".format(code=exit_code)) if exit_code != 0: raise errors.DistutilsError("Type-checking failed.")