sys.path.insert(0, lib) sys.path.insert(0, current_vendors) try: try: from poetry.core.factory import Factory from poetry.core.masonry.builders.sdist import SdistBuilder except (ImportError, ModuleNotFoundError): from poetry.masonry.builders.sdist import SdistBuilder from poetry.factory import Factory from poetry.__version__ import __version__ except (ImportError, ModuleNotFoundError) as ee: raise ImportError( f"install poetry by doing pip install poetry to use this script: {ee}") # Generate a Poetry object that knows about the metadata in pyproject.toml factory = Factory() poetry = factory.create_poetry(os.path.dirname(__file__)) # Use the SdistBuilder to genrate a blob for setup.py if StrictVersion(__version__) >= StrictVersion("1.1.0b1"): sdist_builder = SdistBuilder(poetry, None) else: sdist_builder = SdistBuilder(poetry, None, None) setuppy_blob = sdist_builder.build_setup() with open("setup.py", "wb") as unit: unit.write(setuppy_blob) unit.write(b"\n# This setup.py was autogenerated using poetry.\n")
try: try: from poetry.core.factory import Factory from poetry.core.masonry.builders.sdist import SdistBuilder except (ImportError, ModuleNotFoundError): from poetry.masonry.builders.sdist import SdistBuilder from poetry.factory import Factory from poetry.__version__ import __version__ except (ImportError, ModuleNotFoundError) as ee: raise ImportError( "install poetry by doing pip install poetry to use " f"this script: {ee}" ) # Generate a Poetry object that knows about the metadata in pyproject.toml factory = Factory() poetry = factory.create_poetry(".") # Use the SdistBuilder to genrate a blob for setup.py if StrictVersion(__version__) >= StrictVersion("1.1.0b1"): sdist_builder = SdistBuilder(poetry, None) else: sdist_builder = SdistBuilder(poetry, None, None) setuppy_blob = sdist_builder.build_setup() with open("setup.py", "wb") as unit: unit.write(setuppy_blob) unit.write(b"\n# This setup.py was autogenerated by https://github.com/jvansanten/poetry-export-to-legacy-action. Do not edit!\n")