pimutils / khal

:calendar: CLI calendar application
https://lostpackets.de/khal/
MIT License
2.62k stars 207 forks source link

Installation via pip reports bad syntax in ui/widgets.py, then reports success #465

Closed pmocek closed 8 years ago

pmocek commented 8 years ago

When I used pip as superuser to build and install khal on Ubuntu 14.04, compilation of .../khal/ui/widgets.py fails with a syntax error, but pip reports successful installation:

$ sudo pip install khal
[sudo] password for pmocek: 
Downloading/unpacking khal
  Downloading khal-0.8.2-py2.py3-none-any.whl (92kB): 92kB downloaded
Downloading/unpacking tzlocal>=1.0 (from khal)
  Downloading tzlocal-1.2.2.tar.gz
  Running setup.py (path:/tmp/pip_build_root/tzlocal/setup.py) egg_info for package tzlocal

Downloading/unpacking icalendar (from khal)
  Downloading icalendar-3.10.tar.gz (67kB): 67kB downloaded
  Running setup.py (path:/tmp/pip_build_root/icalendar/setup.py) egg_info for package icalendar

    warning: no previously-included files matching '*.pyc' found under directory 'src/icalendar'
    warning: no previously-included files matching '*~' found under directory 'src/icalendar'
Requirement already satisfied (use --upgrade to upgrade): pyxdg in /usr/lib/python2.7/dist-packages (from khal)
Requirement already satisfied (use --upgrade to upgrade): pytz in /usr/local/lib/python2.7/dist-packages (from khal)
Downloading/unpacking vdirsyncer (from khal)
  Downloading vdirsyncer-0.11.3-py2.py3-none-any.whl (59kB): 59kB downloaded
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/local/lib/python2.7/dist-packages (from khal)
Downloading/unpacking urwid (from khal)
  Downloading urwid-1.3.1.tar.gz (588kB): 588kB downloaded
  Running setup.py (path:/tmp/pip_build_root/urwid/setup.py) egg_info for package urwid

    warning: no files found matching 'CHANGELOG'
Downloading/unpacking configobj (from khal)
  Downloading configobj-5.0.6.tar.gz
  Running setup.py (path:/tmp/pip_build_root/configobj/setup.py) egg_info for package configobj

Requirement already satisfied (use --upgrade to upgrade): click>=3.2 in /usr/local/lib/python2.7/dist-packages (from khal)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python2.7/dist-packages (from icalendar->khal)
Downloading/unpacking click-threading>=0.2 (from vdirsyncer->khal)
  Downloading click_threading-0.4.0-py2.py3-none-any.whl
Downloading/unpacking requests-toolbelt>=0.4.0 (from vdirsyncer->khal)
  Downloading requests_toolbelt-0.7.0-py2.py3-none-any.whl (52kB): 52kB downloaded
Downloading/unpacking atomicwrites>=0.1.7 (from vdirsyncer->khal)
  Downloading atomicwrites-1.1.0-py2.py3-none-any.whl
Downloading/unpacking requests>=2.4.1,!=2.9.0 (from vdirsyncer->khal)
  Downloading requests-2.10.0-py2.py3-none-any.whl (506kB): 506kB downloaded
Downloading/unpacking click-log>=0.1.3 (from vdirsyncer->khal)
  Downloading click_log-0.1.4-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/dist-packages (from configobj->khal)
Requirement already satisfied (use --upgrade to upgrade): futures in /usr/local/lib/python2.7/dist-packages (from click-threading>=0.2->vdirsyncer->khal)
Installing collected packages: khal, tzlocal, icalendar, vdirsyncer, urwid, configobj, click-threading, requests-toolbelt, atomicwrites, requests, click-log
Compiling /tmp/pip_build_root/khal/khal/ui/widgets.py ...
  File "/tmp/pip_build_root/khal/khal/ui/widgets.py", line 383
    def __init__(self, *args, EditWidget=ExtendedEdit, validate=False, **kwargs):
                                       ^
SyntaxError: invalid syntax

  Running setup.py install for tzlocal

  Running setup.py install for icalendar

    warning: no previously-included files matching '*.pyc' found under directory 'src/icalendar'
    warning: no previously-included files matching '*~' found under directory 'src/icalendar'
  Running setup.py install for urwid
    building 'urwid.str_util' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c source/str_util.c -o build/temp.linux-x86_64-2.7/source/str_util.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/source/str_util.o -o build/lib.linux-x86_64-2.7/urwid/str_util.so

    warning: no files found matching 'CHANGELOG'
  Running setup.py install for configobj

  Found existing installation: requests 2.2.1
    Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed khal tzlocal icalendar vdirsyncer urwid configobj click-threading requests-toolbelt atomicwrites requests click-log
Cleaning up...

Immediately afterward, when I run khal, it fails with "ImportError: cannot import name get_terminal_size."

$ khal
Traceback (most recent call last):
  File "/usr/local/bin/khal", line 7, in <module>
    from khal.cli import main_khal
  File "/usr/local/lib/python2.7/dist-packages/khal/cli.py", line 25, in <module>
    from shutil import get_terminal_size
ImportError: cannot import name get_terminal_size
pmocek commented 8 years ago

I observe the same behavior if I then uninstall:

$ sudo pip uninstall khal
Uninstalling khal:
  /usr/local/bin/ikhal
  /usr/local/bin/khal
  /usr/local/lib/python2.7/dist-packages/khal-0.8.2.dist-info/DESCRIPTION.rst
  /usr/local/lib/python2.7/dist-packages/khal-0.8.2.dist-info/METADATA
  /usr/local/lib/python2.7/dist-packages/khal-0.8.2.dist-info/RECORD
  /usr/local/lib/python2.7/dist-packages/khal-0.8.2.dist-info/WHEEL
  /usr/local/lib/python2.7/dist-packages/khal-0.8.2.dist-info/entry_points.txt
  /usr/local/lib/python2.7/dist-packages/khal-0.8.2.dist-info/metadata.json
  /usr/local/lib/python2.7/dist-packages/khal-0.8.2.dist-info/pbr.json
  /usr/local/lib/python2.7/dist-packages/khal-0.8.2.dist-info/top_level.txt
  /usr/local/lib/python2.7/dist-packages/khal/__init__.py
  /usr/local/lib/python2.7/dist-packages/khal/__init__.pyc
  /usr/local/lib/python2.7/dist-packages/khal/__main__.py
  /usr/local/lib/python2.7/dist-packages/khal/__main__.pyc
  /usr/local/lib/python2.7/dist-packages/khal/aux.py
  /usr/local/lib/python2.7/dist-packages/khal/aux.pyc
  /usr/local/lib/python2.7/dist-packages/khal/calendar_display.py
  /usr/local/lib/python2.7/dist-packages/khal/calendar_display.pyc
  /usr/local/lib/python2.7/dist-packages/khal/cli.py
  /usr/local/lib/python2.7/dist-packages/khal/cli.pyc
  /usr/local/lib/python2.7/dist-packages/khal/configwizard.py
  /usr/local/lib/python2.7/dist-packages/khal/configwizard.pyc
  /usr/local/lib/python2.7/dist-packages/khal/controllers.py
  /usr/local/lib/python2.7/dist-packages/khal/controllers.pyc
  /usr/local/lib/python2.7/dist-packages/khal/exceptions.py
  /usr/local/lib/python2.7/dist-packages/khal/exceptions.pyc
  /usr/local/lib/python2.7/dist-packages/khal/khalendar/__init__.py
  /usr/local/lib/python2.7/dist-packages/khal/khalendar/__init__.pyc
  /usr/local/lib/python2.7/dist-packages/khal/khalendar/aux.py
  /usr/local/lib/python2.7/dist-packages/khal/khalendar/aux.pyc
  /usr/local/lib/python2.7/dist-packages/khal/khalendar/backend.py
  /usr/local/lib/python2.7/dist-packages/khal/khalendar/backend.pyc
  /usr/local/lib/python2.7/dist-packages/khal/khalendar/event.py
  /usr/local/lib/python2.7/dist-packages/khal/khalendar/event.pyc
  /usr/local/lib/python2.7/dist-packages/khal/khalendar/exceptions.py
  /usr/local/lib/python2.7/dist-packages/khal/khalendar/exceptions.pyc
  /usr/local/lib/python2.7/dist-packages/khal/khalendar/khalendar.py
  /usr/local/lib/python2.7/dist-packages/khal/khalendar/khalendar.pyc
  /usr/local/lib/python2.7/dist-packages/khal/log.py
  /usr/local/lib/python2.7/dist-packages/khal/log.pyc
  /usr/local/lib/python2.7/dist-packages/khal/settings/__init__.py
  /usr/local/lib/python2.7/dist-packages/khal/settings/__init__.pyc
  /usr/local/lib/python2.7/dist-packages/khal/settings/exceptions.py
  /usr/local/lib/python2.7/dist-packages/khal/settings/exceptions.pyc
  /usr/local/lib/python2.7/dist-packages/khal/settings/khal.spec
  /usr/local/lib/python2.7/dist-packages/khal/settings/settings.py
  /usr/local/lib/python2.7/dist-packages/khal/settings/settings.pyc
  /usr/local/lib/python2.7/dist-packages/khal/settings/utils.py
  /usr/local/lib/python2.7/dist-packages/khal/settings/utils.pyc
  /usr/local/lib/python2.7/dist-packages/khal/terminal.py
  /usr/local/lib/python2.7/dist-packages/khal/terminal.pyc
  /usr/local/lib/python2.7/dist-packages/khal/ui/__init__.py
  /usr/local/lib/python2.7/dist-packages/khal/ui/__init__.pyc
  /usr/local/lib/python2.7/dist-packages/khal/ui/base.py
  /usr/local/lib/python2.7/dist-packages/khal/ui/base.pyc
  /usr/local/lib/python2.7/dist-packages/khal/ui/calendarwidget.py
  /usr/local/lib/python2.7/dist-packages/khal/ui/calendarwidget.pyc
  /usr/local/lib/python2.7/dist-packages/khal/ui/colors.py
  /usr/local/lib/python2.7/dist-packages/khal/ui/colors.pyc
  /usr/local/lib/python2.7/dist-packages/khal/ui/startendeditor.py
  /usr/local/lib/python2.7/dist-packages/khal/ui/startendeditor.pyc
  /usr/local/lib/python2.7/dist-packages/khal/ui/widgets.py
  /usr/local/lib/python2.7/dist-packages/khal/version.py
  /usr/local/lib/python2.7/dist-packages/khal/version.pyc
Proceed (y/n)? y
  Successfully uninstalled khal

And reinstall:

$ sudo pip install khal
Downloading/unpacking khal
  Downloading khal-0.8.2-py2.py3-none-any.whl (92kB): 92kB downloaded
Requirement already satisfied (use --upgrade to upgrade): tzlocal>=1.0 in /usr/local/lib/python2.7/dist-packages (from khal)
Requirement already satisfied (use --upgrade to upgrade): icalendar in /usr/local/lib/python2.7/dist-packages (from khal)
Requirement already satisfied (use --upgrade to upgrade): pyxdg in /usr/lib/python2.7/dist-packages (from khal)
Requirement already satisfied (use --upgrade to upgrade): pytz in /usr/local/lib/python2.7/dist-packages (from khal)
Requirement already satisfied (use --upgrade to upgrade): vdirsyncer in /usr/local/lib/python2.7/dist-packages (from khal)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/local/lib/python2.7/dist-packages (from khal)
Requirement already satisfied (use --upgrade to upgrade): urwid in /usr/local/lib/python2.7/dist-packages (from khal)
Requirement already satisfied (use --upgrade to upgrade): configobj in /usr/local/lib/python2.7/dist-packages (from khal)
Requirement already satisfied (use --upgrade to upgrade): click>=3.2 in /usr/local/lib/python2.7/dist-packages (from khal)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python2.7/dist-packages (from icalendar->khal)
Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/dist-packages (from configobj->khal)
Installing collected packages: khal
Compiling /tmp/pip_build_root/khal/khal/ui/widgets.py ...
  File "/tmp/pip_build_root/khal/khal/ui/widgets.py", line 383
    def __init__(self, *args, EditWidget=ExtendedEdit, validate=False, **kwargs):
                                       ^
SyntaxError: invalid syntax

Successfully installed khal
Cleaning up...

$ khal
Traceback (most recent call last):
  File "/usr/local/bin/khal", line 7, in <module>
    from khal.cli import main_khal
  File "/usr/local/lib/python2.7/dist-packages/khal/cli.py", line 25, in <module>
    from shutil import get_terminal_size
ImportError: cannot import name get_terminal_size
geier commented 8 years ago

as of version 0.8 we do not support python 2 any longer. Have a look if you have pip3. Also, as I see, the wheels are still indicate python 2 support, so that should be fixed, see #468.