LoginSignup
1
2

More than 5 years have passed since last update.

Python2.5でVoluptuousをインストールする

Last updated at Posted at 2016-01-01

Python 2.5環境でVoluptuousをインストールする手順。

Voluptuousとは

PythonでVoluptuousを用いたJSONのvalidation に移動。

課題

Python 2.5にインストール出来ない。

# tar xvf voluptuous-0.8.8.tar.gz
voluptuous-0.8.8/
voluptuous-0.8.8/.gitignore
voluptuous-0.8.8/.travis.yml
voluptuous-0.8.8/COPYING
voluptuous-0.8.8/MANIFEST.in
voluptuous-0.8.8/README.md
voluptuous-0.8.8/setup.cfg
voluptuous-0.8.8/setup.py
voluptuous-0.8.8/tests.md
voluptuous-0.8.8/tests.py
voluptuous-0.8.8/tox.ini
voluptuous-0.8.8/voluptuous.py
# cd voluptuous-0.8.8
voluptuous-0.8.8# python setup.py install
setup.py:15: Warning: 'with' will become a reserved keyword in Python 2.6
  File "setup.py", line 15
    with open('README.rst', 'w') as f:
            ^
SyntaxError: invalid syntax
voluptuous-0.8.8#

元々サポート対象外なので仕方ない。

対策

Voluptuousの過去のバージョンをインストールする

ダメでした。
現時点(2016/1)で最新版のvoluptuous-0.8.8ではPython 2.5非対応でも、
過去のバージョンでは対応しているのでは、と思ったものの初コミットの時点でPython 2.5非対応だった。

Python 2.5対応パッチを作る

voluptuousをPython 2.5で動作するようにするパッチを作成した。
https://gist.github.com/thombashi/5be8a602df933851d2fd1af73cb1bb0e

このパッチを当てて

# patch -p1 < voluptuous_python25.patch
patching file voluptuous-0.8.8/setup.py
patching file voluptuous-0.8.8/voluptuous.py
#

インストール

# cd voluptuous-0.8.8
voluptuous-0.8.8# python setup.py install
WARNING: Could not locate pandoc, using Markdown long_description.
running install
running bdist_egg
running egg_info
writing requirements to voluptuous.egg-info/requires.txt
writing voluptuous.egg-info/PKG-INFO
writing top-level names to voluptuous.egg-info/top_level.txt
writing dependency_links to voluptuous.egg-info/dependency_links.txt
reading manifest file 'voluptuous.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'voluptuous.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-i686/egg
running install_lib
running build_py
copying voluptuous.py -> build/lib
creating build/bdist.linux-i686/egg
copying build/lib/voluptuous.py -> build/bdist.linux-i686/egg
byte-compiling build/bdist.linux-i686/egg/voluptuous.py to voluptuous.pyc
creating build/bdist.linux-i686/egg/EGG-INFO
copying voluptuous.egg-info/PKG-INFO -> build/bdist.linux-i686/egg/EGG-INFO
copying voluptuous.egg-info/SOURCES.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying voluptuous.egg-info/dependency_links.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying voluptuous.egg-info/requires.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying voluptuous.egg-info/top_level.txt -> build/bdist.linux-i686/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/voluptuous-0.8.8-py2.5.egg' and adding 'build/bdist.linux-i686/egg' to it
removing 'build/bdist.linux-i686/egg' (and everything under it)
Processing voluptuous-0.8.8-py2.5.egg
Removing /usr/lib/python2.5/site-packages/voluptuous-0.8.8-py2.5.egg
Copying voluptuous-0.8.8-py2.5.egg to /usr/lib/python2.5/site-packages
voluptuous 0.8.8 is already the active version in easy-install.pth

Installed /usr/lib/python2.5/site-packages/voluptuous-0.8.8-py2.5.egg
Processing dependencies for voluptuous==0.8.8
Searching for setuptools==0.6c8
Best match: setuptools 0.6c8
setuptools 0.6c8 is already the active version in easy-install.pth
Installing easy_install script to /usr/bin
Installing easy_install-2.5 script to /usr/bin
Installing easy_install-2.4 script to /usr/bin

Using /usr/lib/python2.5/site-packages
Finished processing dependencies for voluptuous==0.8.8
voluptuous-0.8.8#

インストールできた。

うーん、Python 2.5から卒業したい。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2