Skip to content

Commit

Permalink
Release of 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Sep 26, 2022
1 parent a2084e4 commit 6e36311
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 32 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## 0.4.1 - 2022-09-26

* Remove some print statements
* Fix if the destination is an empty file

## 0.4.0 - 2022-09-22

* Enable Python 3.10
Expand Down
4 changes: 2 additions & 2 deletions qgis_plugin_repo/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

class Dispatcher:

def __init__(self, input_uri: Union[Path, str], outputs_uri: List[str]):
def __init__(self, input_uri: Union[Path, str], outputs_uri: List[Union[Path, str]]):
""" Constructor. """
self.input_uri = input_uri
if is_url:
if is_url(input_uri):
self.input_parser = ET.fromstring(requests.get(self.input_uri).content)
else:
self.input_parser = ET.parse(self.input_uri.absolute()).getroot()
Expand Down
16 changes: 0 additions & 16 deletions qgis_plugin_repo/merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,6 @@ def xml_output_parser(self) -> ET.Element:
self.output_parser = self.output_tree.getroot()
return self.output_parser

def input_is_url(self) -> bool:
""" Check if the input is a URL. """
if isinstance(self.input_uri, Path):
return False

path = Path(self.input_uri)
if path.exists():
return False

# noinspection PyBroadException
try:
urlparse(self.input_uri)
return True
except Exception:
return False

@staticmethod
def plugins(parser) -> list:
""" Return the plugins in the XML file. """
Expand Down
29 changes: 15 additions & 14 deletions tests/test_merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from qgis_plugin_repo.dispatcher import Dispatcher
from qgis_plugin_repo.merger import Merger, Plugin
from qgis_plugin_repo.tools import is_url

__copyright__ = 'Copyright 2021, 3Liz'
__license__ = 'GPL version 3'
Expand Down Expand Up @@ -43,7 +44,7 @@ def test_empty_repo(self):
merger.xml_input_parser()
input_plugins = merger.plugins(merger.input_parser)
self.assertEqual(len(input_plugins), 1)
self.assertFalse(merger.input_is_url())
self.assertFalse(is_url(merger.input_uri))

merger.xml_output_parser()
output_plugins = []
Expand All @@ -66,7 +67,7 @@ def test_existing_repo_stable(self):
merger.xml_input_parser()
input_plugins = merger.plugins(merger.input_parser)
self.assertEqual(len(input_plugins), 1)
self.assertFalse(merger.input_is_url())
self.assertFalse(is_url(merger.input_uri))

merger.xml_output_parser()
output_plugins = [
Expand Down Expand Up @@ -100,7 +101,7 @@ def test_existing_repo_experimental(self):
merger.xml_input_parser()
input_plugins = merger.plugins(merger.input_parser)
self.assertEqual(len(input_plugins), 1)
self.assertFalse(merger.input_is_url())
self.assertFalse(is_url(merger.input_uri))

merger.xml_output_parser()
output_plugins = [
Expand Down Expand Up @@ -144,7 +145,7 @@ def test_url(self):
Path("fixtures/plugins.xml"),
"https://github.com/3liz/qgis-pgmetadata-plugin/releases/download/0.2.2/plugins.xml"
)
self.assertTrue(merger.input_is_url())
self.assertTrue(is_url(merger.input_uri))

def test_count(self):
""" Test to count plugins in an XML file. """
Expand All @@ -165,11 +166,11 @@ def test_dispatcher_plugin_stable(self):
dispatcher = Dispatcher(
Path("fixtures/pgmetadata_stable.xml"),
[
"fixtures/plugins_tmp-3.4.xml",
"fixtures/plugins_tmp-3.10.xml",
"fixtures/plugins_tmp-3.16.xml",
"fixtures/plugins_tmp-3.22.xml",
"fixtures/plugins_tmp-3.28.xml",
Path("fixtures/plugins_tmp-3.4.xml"),
Path("fixtures/plugins_tmp-3.10.xml"),
Path("fixtures/plugins_tmp-3.16.xml"),
Path("fixtures/plugins_tmp-3.22.xml"),
Path("fixtures/plugins_tmp-3.28.xml"),
]
)
qgis_min, qgis_max = dispatcher.versions_for_plugin()
Expand All @@ -189,11 +190,11 @@ def test_dispatcher_plugin_dev(self):
dispatcher = Dispatcher(
Path("fixtures/pgmetadata_experimental.xml"),
[
"fixtures/plugins_tmp-3.4.xml",
"fixtures/plugins_tmp-3.10.xml",
"fixtures/plugins_tmp-3.16.xml",
"fixtures/plugins_tmp-3.22.xml",
"fixtures/plugins_tmp-3.28.xml",
Path("fixtures/plugins_tmp-3.4.xml"),
Path("fixtures/plugins_tmp-3.10.xml"),
Path("fixtures/plugins_tmp-3.16.xml"),
Path("fixtures/plugins_tmp-3.22.xml"),
Path("fixtures/plugins_tmp-3.28.xml"),
]
)
qgis_min, qgis_max = dispatcher.versions_for_plugin()
Expand Down

0 comments on commit 6e36311

Please sign in to comment.