kovidgoyal / powerline-daemon

A daemon to reduce the resource consumption of powerline by having a single python process that serves all powerline requests
38 stars 6 forks source link

Encoding error happens in setup for python3 #10

Open hanwentao opened 10 years ago

hanwentao commented 10 years ago

It seems that python3 does more rigorous check in scripts keyword.

------------------------------------------------------------
/usr/local/bin/pip3 run on Sun Feb 23 10:12:36 2014
Unpacking /Users/hanwentao/repo/powerline-daemon
  Running setup.py (path:/var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-c460dc-build/setup.py) egg_info for package from file:///Users/hanwentao/repo/powerline-daemon
    running egg_info
    creating pip-egg-info/powerline_daemon.egg-info
    writing dependency_links to pip-egg-info/powerline_daemon.egg-info/dependency_links.txt
    writing top-level names to pip-egg-info/powerline_daemon.egg-info/top_level.txt
    writing pip-egg-info/powerline_daemon.egg-info/PKG-INFO
    writing manifest file 'pip-egg-info/powerline_daemon.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pip-egg-info/powerline_daemon.egg-info/SOURCES.txt'
    writing manifest file 'pip-egg-info/powerline_daemon.egg-info/SOURCES.txt'
  Source in /var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-c460dc-build has version 1.0, which satisfies requirement powerline-daemon==1.0 from file:///Users/hanwentao/repo/powerline-daemon
Installing collected packages: powerline-daemon
  Running setup.py install for powerline-daemon
    Running command /usr/local/opt/python3/bin/python3.3 -c "import setuptools, tokenize;__file__='/var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-c460dc-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-xtfw2m-record/install-record.txt --single-version-externally-managed --compile
    running install
    running build
    running build_scripts
    Traceback (most recent call last):
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/tokenize.py", line 369, in find_cookie
        line_string = line.decode('utf-8')
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 0: invalid continuation byte

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-c460dc-build/setup.py", line 36, in <module>
        scripts=['powerline-daemon', 'powerline-client']
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/dist.py", line 930, in run_commands
        self.run_command(cmd)
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/dist.py", line 949, in run_command
        cmd_obj.run()
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-2.1-py3.3.egg/setuptools/command/install.py", line 54, in run
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/command/install.py", line 569, in run
        self.run_command('build')
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/dist.py", line 949, in run_command
        cmd_obj.run()
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/command/build.py", line 126, in run
        self.run_command(cmd_name)
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/dist.py", line 949, in run_command
        cmd_obj.run()
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/command/build_scripts.py", line 50, in run
        self.copy_scripts()
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/command/build_scripts.py", line 82, in copy_scripts
        encoding, lines = tokenize.detect_encoding(f.readline)
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/tokenize.py", line 410, in detect_encoding
        encoding = find_cookie(first)
      File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/tokenize.py", line 374, in find_cookie
        raise SyntaxError(msg)
    SyntaxError: invalid or missing encoding declaration for 'powerline-client'
    Complete output from command /usr/local/opt/python3/bin/python3.3 -c "import setuptools, tokenize;__file__='/var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-c460dc-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-xtfw2m-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_scripts

Traceback (most recent call last):

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/tokenize.py", line 369, in find_cookie

    line_string = line.decode('utf-8')

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 0: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-c460dc-build/setup.py", line 36, in <module>

    scripts=['powerline-daemon', 'powerline-client']

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/core.py", line 148, in setup

    dist.run_commands()

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/dist.py", line 930, in run_commands

    self.run_command(cmd)

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/dist.py", line 949, in run_command

    cmd_obj.run()

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/setuptools-2.1-py3.3.egg/setuptools/command/install.py", line 54, in run

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/command/install.py", line 569, in run

    self.run_command('build')

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/cmd.py", line 313, in run_command

    self.distribution.run_command(command)

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/dist.py", line 949, in run_command

    cmd_obj.run()

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/command/build.py", line 126, in run

    self.run_command(cmd_name)

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/cmd.py", line 313, in run_command

    self.distribution.run_command(command)

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/dist.py", line 949, in run_command

    cmd_obj.run()

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/command/build_scripts.py", line 50, in run

    self.copy_scripts()

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/command/build_scripts.py", line 82, in copy_scripts

    encoding, lines = tokenize.detect_encoding(f.readline)

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/tokenize.py", line 410, in detect_encoding

    encoding = find_cookie(first)

  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/tokenize.py", line 374, in find_cookie

    raise SyntaxError(msg)

SyntaxError: invalid or missing encoding declaration for 'powerline-client'

----------------------------------------
Cleaning up...
Command /usr/local/opt/python3/bin/python3.3 -c "import setuptools, tokenize;__file__='/var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-c460dc-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-xtfw2m-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-c460dc-build
Exception information:
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pip-1.5.2-py3.3.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pip-1.5.2-py3.3.egg/pip/commands/install.py", line 279, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pip-1.5.2-py3.3.egg/pip/req.py", line 1380, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pip-1.5.2-py3.3.egg/pip/req.py", line 699, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/usr/local/Cellar/python3/3.3.4/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pip-1.5.2-py3.3.egg/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command /usr/local/opt/python3/bin/python3.3 -c "import setuptools, tokenize;__file__='/var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-c460dc-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-xtfw2m-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /var/folders/dh/pc596r1d6pdb2mnpznghjgkr0000gn/T/pip-c460dc-build
kovidgoyal commented 10 years ago

This is a limitation of setuptools. It has no way to distribute the powerline-client C implemetation as a script. Your traeback is being called because something is trying to parse the compiled powerline-client as a python script, which it is not.

I haven't really kept up with what is happening with setuptools/pip/whatever other idiotic packaging solution python is using at the moment, so I have no idea how to fix this. You can either change setup.py to not try to compile the C client, or install it by hand (it's just two self contained files).

habnabit commented 7 years ago

I just had to deal with this, fwiw: habnabit/passacre@2ea05ba94eab2d26951ae7b4b51abf53132b20f0.