Commit d12f6421 by Sébastien Eustace

Prepare to move to the Poetry organization

parent 49a7a868
......@@ -299,7 +299,9 @@ class Installer:
r"(?:\+[^\s]+)?"
)
BASE_URL = "https://github.com/sdispater/poetry/releases/download/"
REPOSITORY_URL = "https://github.com/python-poetry/poetry"
BASE_URL = REPOSITORY_URL + "/releases/download/"
FALLBACK_BASE_URL = "https://github.com/sdispater/poetry/releases/download/"
def __init__(
self,
......@@ -849,6 +851,15 @@ def main():
args = parser.parse_args()
base_url = Installer.BASE_URL
try:
r = urlopen(Installer.REPOSITORY_URL)
except HTTPError as e:
if e.code == 404:
base_url = Installer.FALLBACK_BASE_URL
else:
raise
installer = Installer(
version=args.version or os.getenv("POETRY_VERSION"),
preview=args.preview or string_to_bool(os.getenv("POETRY_PREVIEW", "0")),
......@@ -856,6 +867,7 @@ def main():
accept_all=args.accept_all
or string_to_bool(os.getenv("POETRY_ACCEPT", "0"))
or not is_interactive(),
base_url=base_url,
)
if args.uninstall or string_to_bool(os.getenv("POETRY_UNINSTALL", "0")):
......
......@@ -29,7 +29,9 @@ class SelfUpdateCommand(Command):
arguments = [argument("version", "The version to update to.", optional=True)]
options = [option("preview", None, "Install prereleases.")]
BASE_URL = "https://github.com/sdispater/poetry/releases/download"
REPOSITORY_URL = "https://github.com/python-poetry/poetry"
BASE_URL = REPOSITORY_URL + "/releases/download"
FALLBACK_BASE_URL = "https://github.com/sdispater/poetry/releases/download"
@property
def home(self):
......@@ -150,8 +152,17 @@ class SelfUpdateCommand(Command):
checksum = "poetry-{}-{}.sha256sum".format(version, platform)
base_url = self.BASE_URL
try:
r = urlopen(self.BASE_URL + "/{}/{}".format(version, checksum))
urlopen(self.REPOSITORY_URL)
except HTTPError as e:
if e.code == 404:
base_url = self.FALLBACK_BASE_URL
else:
raise
try:
r = urlopen(base_url + "/{}/{}".format(version, checksum))
except HTTPError as e:
if e.code == 404:
raise RuntimeError("Could not find {} file".format(checksum))
......@@ -163,7 +174,7 @@ class SelfUpdateCommand(Command):
# We get the payload from the remote host
name = "poetry-{}-{}.tar.gz".format(version, platform)
try:
r = urlopen(self.BASE_URL + "/{}/{}".format(version, name))
r = urlopen(base_url + "/{}/{}".format(version, name))
except HTTPError as e:
if e.code == 404:
raise RuntimeError("Could not find {} file".format(name))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment