Commit d12f6421 by Sébastien Eustace

Prepare to move to the Poetry organization

parent 49a7a868
...@@ -299,7 +299,9 @@ class Installer: ...@@ -299,7 +299,9 @@ class Installer:
r"(?:\+[^\s]+)?" 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__( def __init__(
self, self,
...@@ -849,6 +851,15 @@ def main(): ...@@ -849,6 +851,15 @@ def main():
args = parser.parse_args() 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( installer = Installer(
version=args.version or os.getenv("POETRY_VERSION"), version=args.version or os.getenv("POETRY_VERSION"),
preview=args.preview or string_to_bool(os.getenv("POETRY_PREVIEW", "0")), preview=args.preview or string_to_bool(os.getenv("POETRY_PREVIEW", "0")),
...@@ -856,6 +867,7 @@ def main(): ...@@ -856,6 +867,7 @@ def main():
accept_all=args.accept_all accept_all=args.accept_all
or string_to_bool(os.getenv("POETRY_ACCEPT", "0")) or string_to_bool(os.getenv("POETRY_ACCEPT", "0"))
or not is_interactive(), or not is_interactive(),
base_url=base_url,
) )
if args.uninstall or string_to_bool(os.getenv("POETRY_UNINSTALL", "0")): if args.uninstall or string_to_bool(os.getenv("POETRY_UNINSTALL", "0")):
......
...@@ -29,7 +29,9 @@ class SelfUpdateCommand(Command): ...@@ -29,7 +29,9 @@ class SelfUpdateCommand(Command):
arguments = [argument("version", "The version to update to.", optional=True)] arguments = [argument("version", "The version to update to.", optional=True)]
options = [option("preview", None, "Install prereleases.")] 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 @property
def home(self): def home(self):
...@@ -150,8 +152,17 @@ class SelfUpdateCommand(Command): ...@@ -150,8 +152,17 @@ class SelfUpdateCommand(Command):
checksum = "poetry-{}-{}.sha256sum".format(version, platform) checksum = "poetry-{}-{}.sha256sum".format(version, platform)
base_url = self.BASE_URL
try: 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: except HTTPError as e:
if e.code == 404: if e.code == 404:
raise RuntimeError("Could not find {} file".format(checksum)) raise RuntimeError("Could not find {} file".format(checksum))
...@@ -163,7 +174,7 @@ class SelfUpdateCommand(Command): ...@@ -163,7 +174,7 @@ class SelfUpdateCommand(Command):
# We get the payload from the remote host # We get the payload from the remote host
name = "poetry-{}-{}.tar.gz".format(version, platform) name = "poetry-{}-{}.tar.gz".format(version, platform)
try: try:
r = urlopen(self.BASE_URL + "/{}/{}".format(version, name)) r = urlopen(base_url + "/{}/{}".format(version, name))
except HTTPError as e: except HTTPError as e:
if e.code == 404: if e.code == 404:
raise RuntimeError("Could not find {} file".format(name)) 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