2023.4 #168

Merged
edraft merged 56 commits from 2023.4 into master 2023-04-12 13:57:51 +02:00
3 changed files with 22 additions and 3 deletions
Showing only changes of commit 82b3a22ac8 - Show all commits

View File

@ -136,6 +136,12 @@ class InstallService(CommandABC):
if "==" in package: if "==" in package:
name = package.split("==")[0] name = package.split("==")[0]
package_version = package.split("==")[1] package_version = package.split("==")[1]
elif ">=" in package:
name = package.split(">=")[0]
package_version = package.split(">=")[1]
elif "<=" in package:
name = package.split("<=")[0]
package_version = package.split("<=")[1]
to_remove_list = [] to_remove_list = []
deps = self._project_settings.dependencies deps = self._project_settings.dependencies
@ -147,6 +153,10 @@ class InstallService(CommandABC):
if "==" in dependency: if "==" in dependency:
dependency_version = dependency.split("==")[1] dependency_version = dependency.split("==")[1]
elif "<=" in dependency:
dependency_version = dependency.split("<=")[1]
elif ">=" in dependency:
dependency_version = dependency.split(">=")[1]
if name in dependency: if name in dependency:
if package_version != "" and version.parse(package_version) != version.parse(dependency_version): if package_version != "" and version.parse(package_version) != version.parse(dependency_version):
@ -185,19 +195,24 @@ class InstallService(CommandABC):
new_package = name new_package = name
else: else:
new_package = Pip.get_package(name) new_package = Pip.get_package(name)
if ( if (
new_package is None new_package is None
or "==" in package or "==" in package
and version.parse(package.split("==")[1]) != version.parse(new_package.split("==")[1]) and version.parse(package.split("==")[1]) != version.parse(new_package.split("==")[1])
or "<=" in package
and version.parse(package.split("<=")[1]) != version.parse(new_package.split("<=")[1])
or ">=" in package
and version.parse(package.split(">=")[1]) != version.parse(new_package.split(">=")[1])
): ):
Console.error(f"Installation of package {package} failed") Console.error(f"Installation of package {package} failed")
return return
if not is_already_in_project: if not is_already_in_project:
new_name = package new_name = package
if "==" in new_package: if "==" in new_package or ">=" in new_package or "<=" in new_package:
new_name = new_package new_name = new_package
elif "==" in name: elif "==" in name or ">=" in name or "<=" in name:
new_name = name new_name = name
if "/" in new_name: if "/" in new_name:

View File

@ -66,6 +66,10 @@ class UpdateService(CommandABC):
name = package name = package
if "==" in package: if "==" in package:
name = package.split("==")[0] name = package.split("==")[0]
elif ">=" in package:
name = package.split(">=")[0]
elif "<=" in package:
name = package.split("<=")[0]
dependencies.append((package, name)) dependencies.append((package, name))

View File

@ -22,7 +22,7 @@ class UpdateTestCase(CommandTestCase):
self._old_package = f"{self._old_package_name}=={self._old_version}" self._old_package = f"{self._old_package_name}=={self._old_version}"
# todo: better way to do shit required # todo: better way to do shit required
self._new_version = "2.1.0" self._new_version = "2.2.2"
self._new_package_name = "discord.py" self._new_package_name = "discord.py"
self._new_package = f"{self._new_package_name}=={self._new_version}" self._new_package = f"{self._new_package_name}=={self._new_version}"