def build_pypi_package(pyre_directory: Path, typeshed_path: Path, version: str, nightly: bool) -> None: _validate_typeshed(typeshed_path) _validate_version(version) if not _binary_exists(pyre_directory): raise ValueError("The binary file does not exist. \ Have you run 'make' in the toplevel directory?") dependencies = [ line.strip() for line in (pyre_directory / "requirements.txt").read_text().split("\n") if len(line) > 0 ] with tempfile.TemporaryDirectory() as build_root: build_path = Path(build_root) _add_init_files(build_path, version) _create_setup_py(pyre_directory, version, build_path, dependencies, nightly) _sync_python_files(pyre_directory, build_path) _sync_pysa_stubs(pyre_directory, build_path) _sync_stubs(pyre_directory, build_path) _sync_typeshed(build_path, typeshed_path) _sync_sapp_filters(pyre_directory, build_path) _sync_binary(pyre_directory, build_path) _strip_binary(build_path) _sync_documentation_files(pyre_directory, build_path) _patch_version(version, build_path) _run_setup_command( pyre_directory, # pyre-fixme[6]: Expected `Path` for 2nd param but got `str`. build_root, dependencies, version, "sdist", nightly, ) _create_dist_directory(pyre_directory) _create_setup_configuration(build_path) twine_check( [path.as_posix() for path in (build_path / "dist").iterdir()]) _run_setup_command( pyre_directory, # pyre-fixme[6]: Expected `Path` for 2nd param but got `str`. build_root, dependencies, version, "bdist_wheel", nightly, ) wheel_destination, distribution_destination = _rename_and_move_artifacts( pyre_directory, build_path) LOG.info("All done.") LOG.info( "\n Build artifact available at:\n {}\n".format(wheel_destination)) LOG.info("\n Source distribution available at:\n {}\n".format( distribution_destination))
def build_pypi_package( pyre_directory: Path, typeshed_path: Path, version: str, nightly: bool ) -> None: _validate_typeshed(typeshed_path) _validate_version(version) if not _binary_exists(pyre_directory): raise ValueError( "The binary file does not exist. \ Have you run 'make' in the toplevel directory?" ) with tempfile.TemporaryDirectory() as build_root: build_path = Path(build_root) _add_init_files(build_path, version) _patch_version(version, build_path) _create_setup_py(pyre_directory, version, build_path, nightly) _sync_python_files(pyre_directory, build_path) _sync_pysa_stubs(pyre_directory, build_path) _sync_stubs(pyre_directory, build_path) _sync_typeshed(build_path, typeshed_path) _sync_binary(pyre_directory, build_path) _sync_documentation_files(pyre_directory, build_path) _sync_stubs(pyre_directory, build_path) _run_setup_command(pyre_directory, build_root, version, "sdist", nightly) _create_dist_directory(pyre_directory) _create_setup_configuration(build_path) twine_check([path.as_posix() for path in (build_path / "dist").iterdir()]) _run_setup_command(pyre_directory, build_root, version, "bdist_wheel", nightly) wheel_destination, distribution_destination = _rename_and_move_artifacts( pyre_directory, build_path ) LOG.info("All done.") LOG.info("\n Build artifact available at:\n {}\n".format(wheel_destination)) LOG.info( "\n Source distribution available at:\n {}\n".format( distribution_destination ) )
def run(pyre_directory: Path, typeshed_path: Path, version: str) -> None: validate_typeshed(typeshed_path) validate_version(version) if not binary_exists(pyre_directory): raise ValueError( "The binary file does not exist. \ Have you run 'make' in the toplevel directory?" ) with tempfile.TemporaryDirectory() as build_root: build_path = Path(build_root) add_init_files(build_path) patch_version(version, build_path) create_setup_py(pyre_directory, version, build_path) sync_python_files(pyre_directory, build_path) sync_pysa_stubs(pyre_directory, build_path) sync_stubs(pyre_directory, build_path) sync_sapp_files(pyre_directory, build_path) sync_typeshed(build_path, typeshed_path) sync_binary(pyre_directory, build_path) sync_documentation_files(pyre_directory, build_path) sync_stubs(pyre_directory, build_path) build_distribution(pyre_directory, build_path, version) create_dist_directory(pyre_directory) create_setup_cfg(build_path) twine_check([path.as_posix() for path in (build_path / "dist").iterdir()]) build_wheel(pyre_directory, build_path, version) wheel_destination, distribution_destination = rename_and_move_artifacts( pyre_directory, build_path ) print("\nAll done.") print("\n Build artifact available at:\n {}\n".format(wheel_destination)) print( "\n Source distribution available at:\n {}\n".format( distribution_destination ) )
def _validate_dist(self, **kwargs): """ Validate dist """ twine_check([self.dist_path])