Skip to content

Commit

Permalink
Add some friendlier help for the import command when missing vobject
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarnett committed Aug 25, 2024
1 parent cad3a50 commit 58ffd74
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
v4.4.0
* Fix lots of bugs by switching from deprecated oauth2client to
google_auth_oauthlib
* Friendlier help output when `import` command is missing vobject extra
* Handle encoding/decoding errors more gracefully by replacing with
placeholder chars instead of blowing up
* Fix `--lineart` option failing with unicode errors
Expand Down
11 changes: 11 additions & 0 deletions gcalcli/gcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,17 @@ def ImportICS(self, verbose=False, dump=False, reminders=None,
self.printer.err_msg(
'Python vobject module not installed!\n'
)
self.printer.msg(
'To use the import command, you need to first install the '
'"vobject" extra.\n'
'For setup instructions, see '
"https://github.com/insanum/gcalcli and documentation for the "
'gcalcli package on your platform.\n')
sys_path_str = '\n '.join(sys.path)
self.printer.debug_msg(
'Searched for vobject using python interpreter at '
f'"{sys.executable}" with module search path:\n'
f" {sys_path_str}\n")
sys.exit(1)

if dump:
Expand Down
3 changes: 1 addition & 2 deletions gcalcli/ics.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""Helpers for working with iCal/ics format."""

from datetime import datetime
import importlib.util
import io
from datetime import datetime
from typing import Any, Dict, Iterable, Optional

from gcalcli.printer import Printer
from gcalcli.utils import localize_datetime


EventBody = Dict[str, Any]


Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ dependencies = [
"google_auth_oauthlib",
"parsedatetime",
"argcomplete",
"google-api-python-client-stubs",
]

[project.urls]
Expand Down
2 changes: 2 additions & 0 deletions stubs/vobject/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Fork of Typeshed's stubs to work around explicit export issue
# https://github.com/py-vobject/vobject/issues/53.
from .base import Component, readComponents as readComponents

def iCalendar() -> Component: ...
Expand Down

0 comments on commit 58ffd74

Please sign in to comment.