Browse Source

rename package ics2vdir -> ical2vdir

Fabian Peter Hammerle 4 years ago
parent
commit
e4e068d6bb
10 changed files with 63 additions and 46 deletions
  1. 1 1
      Pipfile
  2. 1 1
      Pipfile.lock
  3. 10 10
      README.md
  4. 2 2
      ical2vdir/__init__.py
  5. 4 4
      setup.py
  6. 29 12
      tests/cli_test.py
  7. 3 3
      tests/datetime_test.py
  8. 3 3
      tests/event_test.py
  9. 2 2
      tests/prop_test.py
  10. 8 8
      tests/vdir_test.py

+ 1 - 1
Pipfile

@@ -4,7 +4,7 @@ verify_ssl = true
 name = "pypi"
 
 [dev-packages]
-ics2vdir = {editable = true,path = "."}
+ical2vdir = {editable = true,path = "."}
 black = "==19.10b0"
 mypy = "*"
 pylint = "*"

+ 1 - 1
Pipfile.lock

@@ -96,7 +96,7 @@
             ],
             "version": "==4.0.4"
         },
-        "ics2vdir": {
+        "ical2vdir": {
             "editable": true,
             "path": "."
         },

+ 10 - 10
README.md

@@ -1,4 +1,4 @@
-# ics2vdir
+# ical2vdir
 
 Convert / split single [iCalendar](https://en.wikipedia.org/wiki/ICalendar)
 `.ics` file into a
@@ -10,33 +10,33 @@ Compatible with [khal](https://github.com/pimutils/khal).
 
 ```sh
 $ sudo apt-get install python3-icalendar # optional
-$ pip3 install --user --upgrade ics2vdir
+$ pip3 install --user --upgrade ical2vdir
 ```
 
 ## Usage
 
 ```sh
-$ ics2vdir < input.ics --output-dir /some/path
+$ ical2vdir < input.ics --output-dir /some/path
 ```
 
 Or download `.ics` from [Google Calendar](https://calendar.google.com/):
 ```sh
 $ curl https://calendar.google.com/calendar/ical/someone%40gmail.com/private-1234/basic.ics \
-    | pipenv run ics2vdir --output-dir output/
+    | pipenv run ical2vdir --output-dir output/
 ```
 
 Remove files from output directory that are not available in input:
 ```sh
-$ ics2vdir < input.ics --output-dir /some/path --delete
+$ ical2vdir < input.ics --output-dir /some/path --delete
 ```
 
 ### Run Tests
 
 ```sh
-$ git clone https://github.com/fphammerle/ics2vdir.git
-$ cd ics2vdir
+$ git clone https://github.com/fphammerle/ical2vdir.git
+$ cd ical2vdir
 $ pipenv sync --dev
-$ pipenv run pylint ics2vdir
-$ pipenv run mypy ics2vdir
-$ pipenv run pytest --cov=ics2vdir --cov-report=term-missing --cov-fail-under=100
+$ pipenv run pylint ical2vdir
+$ pipenv run mypy ical2vdir
+$ pipenv run pytest --cov=ical2vdir --cov-report=term-missing --cov-fail-under=100
 ```

+ 2 - 2
ics2vdir/__init__.py → ical2vdir/__init__.py

@@ -1,4 +1,4 @@
-# ics2vdir - convert .ics file to vdir directory
+# ical2vdir - convert .ics file to vdir directory
 #
 # Copyright (C) 2020 Fabian Peter Hammerle <fabian@hammerle.me>
 #
@@ -90,7 +90,7 @@ def _export_event(
     event: icalendar.cal.Event, output_dir_path: pathlib.Path
 ) -> pathlib.Path:
     temp_fd, temp_path = tempfile.mkstemp(
-        prefix="ics2vdir-", suffix=_VDIR_EVENT_FILE_EXTENSION
+        prefix="ical2vdir-", suffix=_VDIR_EVENT_FILE_EXTENSION
     )
     os.write(temp_fd, event.to_ical())
     os.close(temp_fd)

+ 4 - 4
setup.py

@@ -1,4 +1,4 @@
-# ics2vdir - convert .ics file to vdir directory
+# ical2vdir - convert .ics file to vdir directory
 #
 # Copyright (C) 2020 Fabian Peter Hammerle <fabian@hammerle.me>
 #
@@ -20,7 +20,7 @@ import pathlib
 import setuptools
 
 setuptools.setup(
-    name="ics2vdir",
+    name="ical2vdir",
     use_scm_version=True,
     packages=setuptools.find_packages(),
     description="convert .ics file to vdir directory",
@@ -28,7 +28,7 @@ setuptools.setup(
     long_description_content_type="text/markdown",
     author="Fabian Peter Hammerle",
     author_email="fabian@hammerle.me",
-    url="https://github.com/fphammerle/ics2vdir",
+    url="https://github.com/fphammerle/ical2vdir",
     license="GPLv3+",
     keywords=["calendar", "event", "iCalendar", "ics", "sync", "vdir",],
     classifiers=[
@@ -40,7 +40,7 @@ setuptools.setup(
         "Programming Language :: Python :: 3",
         "Topic :: Utilities",
     ],
-    entry_points={"console_scripts": ["ics2vdir = ics2vdir:_main",]},
+    entry_points={"console_scripts": ["ical2vdir = ical2vdir:_main",]},
     install_requires=["icalendar>=4,<5"],
     setup_requires=["setuptools_scm"],
     tests_require=["pytest"],

+ 29 - 12
tests/cli_test.py

@@ -1,3 +1,20 @@
+# ical2vdir - convert .ics file to vdir directory
+#
+# Copyright (C) 2020 Fabian Peter Hammerle <fabian@hammerle.me>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
 import io
 import logging
 import pathlib
@@ -6,13 +23,13 @@ import unittest.mock
 
 import icalendar
 
-import ics2vdir
+import ical2vdir
 
 # pylint: disable=protected-access
 
 
 def test_entrypoint_help():
-    subprocess.run(["ics2vdir", "--help"], check=True, stdout=subprocess.PIPE)
+    subprocess.run(["ical2vdir", "--help"], check=True, stdout=subprocess.PIPE)
 
 
 def test__main_create_all(
@@ -21,7 +38,7 @@ def test__main_create_all(
     with unittest.mock.patch("sys.stdin", google_calendar_file):
         with unittest.mock.patch("sys.argv", ["", "--output-dir", str(temp_dir_path)]):
             with caplog.at_level(logging.INFO):
-                ics2vdir._main()
+                ical2vdir._main()
     created_item_paths = sorted(temp_dir_path.iterdir())
     assert [p.name for p in created_item_paths] == [
         "1234567890qwertyuiopasdfgh@google.com.ics",
@@ -45,13 +62,13 @@ def test__main_create_some(
 ):
     with unittest.mock.patch("sys.stdin", google_calendar_file):
         with unittest.mock.patch("sys.argv", ["", "--output-dir", str(temp_dir_path)]):
-            ics2vdir._main()
+            ical2vdir._main()
             temp_dir_path.joinpath(
                 "recurr1234567890qwertyuiop@google.com.20150924T090000+0200.ics"
             ).unlink()
             google_calendar_file.seek(0)
             with caplog.at_level(logging.INFO):
-                ics2vdir._main()
+                ical2vdir._main()
     assert len(caplog.records) == 1
     assert caplog.records[0].message.startswith("creating")
     assert caplog.records[0].message.endswith(
@@ -64,7 +81,7 @@ def test__main_update(
 ):
     with unittest.mock.patch("sys.stdin", google_calendar_file):
         with unittest.mock.patch("sys.argv", ["", "--output-dir", str(temp_dir_path)]):
-            ics2vdir._main()
+            ical2vdir._main()
             temp_dir_path.joinpath(
                 "recurr1234567890qwertyuiop@google.com.20150924T090000+0200.ics"
             ).unlink()
@@ -76,7 +93,7 @@ def test__main_update(
                 updated_file.write(updated_ical)
             google_calendar_file.seek(0)
             with caplog.at_level(logging.INFO):
-                ics2vdir._main()
+                ical2vdir._main()
     assert len(caplog.records) == 2
     log_records = sorted(caplog.records, key=lambda r: r.message)
     assert log_records[0].message.startswith("creating")
@@ -96,7 +113,7 @@ def test__main_update_silent(
         with unittest.mock.patch(
             "sys.argv", ["", "--output-dir", str(temp_dir_path), "--silent"]
         ):
-            ics2vdir._main()
+            ical2vdir._main()
             temp_dir_path.joinpath(
                 "recurr1234567890qwertyuiop@google.com.20150924T090000+0200.ics"
             ).unlink()
@@ -108,7 +125,7 @@ def test__main_update_silent(
                 updated_file.write(updated_ical)
             google_calendar_file.seek(0)
             with caplog.at_level(logging.INFO):
-                ics2vdir._main()
+                ical2vdir._main()
     assert len(caplog.records) == 0
 
 
@@ -119,7 +136,7 @@ def test__main_update_verbose(
         with unittest.mock.patch(
             "sys.argv", ["", "--output-dir", str(temp_dir_path), "--verbose"]
         ):
-            ics2vdir._main()
+            ical2vdir._main()
             temp_dir_path.joinpath(
                 "recurr1234567890qwertyuiop@google.com.20150924T090000+0200.ics"
             ).unlink()
@@ -130,7 +147,7 @@ def test__main_update_verbose(
             with updated_path.open("wb") as updated_file:
                 updated_file.write(updated_ical)
             google_calendar_file.seek(0)
-            ics2vdir._main()
+            ical2vdir._main()
     assert any(
         r.message.endswith("1234567890qwertyuiopasdfgh@google.com.ics is up to date")
         for r in caplog.records
@@ -156,7 +173,7 @@ def test__main_delete(
             "sys.argv", ["", "--output-dir", str(temp_dir_path), "--delete"]
         ):
             with caplog.at_level(logging.INFO):
-                ics2vdir._main()
+                ical2vdir._main()
     assert len(list(temp_dir_path.iterdir())) == 3
     assert not any(p.name == "will-be-deleted.ics" for p in temp_dir_path.iterdir())
     assert caplog.records[-1].message.startswith("removing")

+ 3 - 3
tests/datetime_test.py

@@ -1,4 +1,4 @@
-# ics2vdir - convert .ics file to vdir directory
+# ical2vdir - convert .ics file to vdir directory
 #
 # Copyright (C) 2020 Fabian Peter Hammerle <fabian@hammerle.me>
 #
@@ -19,7 +19,7 @@ import datetime
 
 import pytest
 
-import ics2vdir
+import ical2vdir
 
 _CEST = datetime.timezone(datetime.timedelta(hours=+2))
 
@@ -36,4 +36,4 @@ _CEST = datetime.timezone(datetime.timedelta(hours=+2))
 )
 def test__datetime_basic_isoformat(dt_obj, expected_str):
     # pylint: disable=protected-access
-    assert ics2vdir._datetime_basic_isoformat(dt_obj) == expected_str
+    assert ical2vdir._datetime_basic_isoformat(dt_obj) == expected_str

+ 3 - 3
tests/event_test.py

@@ -1,4 +1,4 @@
-# ics2vdir - convert .ics file to vdir directory
+# ical2vdir - convert .ics file to vdir directory
 #
 # Copyright (C) 2020 Fabian Peter Hammerle <fabian@hammerle.me>
 #
@@ -18,7 +18,7 @@
 import icalendar.cal
 import pytest
 
-import ics2vdir
+import ical2vdir
 
 
 @pytest.mark.parametrize(
@@ -148,4 +148,4 @@ def test__events_equal(event_a_ical, event_b_ical, expected_result):
     event_a = icalendar.cal.Event.from_ical(event_a_ical)
     event_b = icalendar.cal.Event.from_ical(event_b_ical)
     # pylint: disable=protected-access
-    assert ics2vdir._events_equal(event_a, event_b) == expected_result
+    assert ical2vdir._events_equal(event_a, event_b) == expected_result

+ 2 - 2
tests/prop_test.py

@@ -1,4 +1,4 @@
-# ics2vdir - convert .ics file to vdir directory
+# ical2vdir - convert .ics file to vdir directory
 #
 # Copyright (C) 2020 Fabian Peter Hammerle <fabian@hammerle.me>
 #
@@ -21,7 +21,7 @@ import typing
 import pytest
 from icalendar.prop import vCalAddress, vDDDLists, vDDDTypes, vInt, vRecur, vText
 
-from ics2vdir import _event_prop_equal
+from ical2vdir import _event_prop_equal
 
 _CEST = datetime.timezone(datetime.timedelta(hours=+2))
 

+ 8 - 8
tests/vdir_test.py

@@ -1,4 +1,4 @@
-# ics2vdir - convert .ics file to vdir directory
+# ical2vdir - convert .ics file to vdir directory
 #
 # Copyright (C) 2020 Fabian Peter Hammerle <fabian@hammerle.me>
 #
@@ -21,7 +21,7 @@ import pathlib
 import icalendar.cal
 import pytest
 
-import ics2vdir
+import ical2vdir
 
 
 def _normalize_ical(ical: bytes) -> bytes:
@@ -76,14 +76,14 @@ END:VEVENT
 )
 def test__event_vdir_filename(event_ical, expected_filename):
     event = icalendar.cal.Event.from_ical(event_ical)
-    assert ics2vdir._event_vdir_filename(event) == expected_filename
+    assert ical2vdir._event_vdir_filename(event) == expected_filename
 
 
 @pytest.mark.parametrize("event_ical", [_SINGLE_EVENT_ICAL])
 def test__export_event_create(tmpdir, event_ical):
     temp_path = pathlib.Path(tmpdir)
     event = icalendar.cal.Event.from_ical(event_ical)
-    ics2vdir._export_event(event, temp_path)
+    ical2vdir._export_event(event, temp_path)
     (ics_path,) = temp_path.iterdir()
     assert ics_path.name == "1qa2ws3ed4rf5tg@google.com.ics"
     assert ics_path.read_bytes() == _SINGLE_EVENT_ICAL
@@ -93,9 +93,9 @@ def test__export_event_create(tmpdir, event_ical):
 def test__export_event_update(tmpdir, event_ical):
     temp_path = pathlib.Path(tmpdir)
     event = icalendar.cal.Event.from_ical(event_ical)
-    ics2vdir._export_event(event, temp_path)
+    ical2vdir._export_event(event, temp_path)
     event["SUMMARY"] += " suffix"
-    ics2vdir._export_event(event, temp_path)
+    ical2vdir._export_event(event, temp_path)
     (ics_path,) = temp_path.iterdir()
     assert ics_path.name == event["UID"] + ".ics"
     assert ics_path.read_bytes() == _SINGLE_EVENT_ICAL.replace(
@@ -107,9 +107,9 @@ def test__export_event_update(tmpdir, event_ical):
 def test__export_event_unchanged(tmpdir, event_ical):
     temp_path = pathlib.Path(tmpdir)
     event = icalendar.cal.Event.from_ical(event_ical)
-    ics2vdir._export_event(event, temp_path)
+    ical2vdir._export_event(event, temp_path)
     (ics_path,) = temp_path.iterdir()
     old_stat = copy.deepcopy(ics_path.stat())
-    ics2vdir._export_event(event, temp_path)
+    ical2vdir._export_event(event, temp_path)
     assert ics_path.stat() == old_stat
     assert ics_path.read_bytes() == _SINGLE_EVENT_ICAL