Date: 2011-04-23
Tags: python

Python-3.3 に標準搭載されるpackaging(Python3.3未満ではDistutils2)を試す

(第7回)Python mini Hack-a-thon 午前の部


"distutils2 には pipやeasy_installと同じような "pysetup" コマンドが搭載され、インストール時の依存関係を解決してくれます。"

"distutils2 will come with a "pysetup" command similar to pip/easy_install that will handle dependencies."

Distutils ML で上記のようなメールを見かけて、Python標準で pysetup コマンドが搭載されるんだなーと言うことを知ったのでさっそくインストールしてみた。 を見ると、以下のように書かれている。

  • distutils2 はPython 2.4-3.2 では "Distutils2" というサードパーティーパッケージとして配布されます

  • distutils2 はPython 3.3に "packaging" という名前で統合されます



Installing distutils2

$ virtualenv du2
$ cd du2
$ source bin/activate
$ python-2.7 install
$ bin/pysetup
Usage: pysetup [options] action [action_options]

run: Run one or several commands
metadata: Display the metadata of a project
install: Install a project
remove: Remove a project
search: Search for a project
graph: Display a graph
create: Create a Project

To get more help on an action, use:

pysetup action --help

Global options:
--verbose (-v) run verbosely (default)
--quiet (-q) run quietly (turns verbosity off)
--dry-run (-n) don't actually do anything
--help (-h) show detailed help message
--no-user-cfg ignore pydistutils.cfg in your home directory
--version Display the version


ふむふむ、動いた動いた。さっそく bucho をインストールしてみるか

pysetup commands

$ bin/pysetup install bucho




pysetup commands

$ bin/pysetup run --list-commands
List of available commands:
bdist: create a built (binary) distribution
bdist_dumb: create a "dumb" built distribution
bdist_wininst: create an executable installer for MS Windows
build: build everything needed to install
build_clib: build C/C++ libraries used by Python extensions
build_ext: build C/C++ extensions (compile/link to build directory)
build_py: "build" pure Python modules (copy to build directory)
build_scripts: "build" scripts (copy and fixup #! line)
check: perform some checks on the package
clean: clean up temporary files from 'build' command
install_data: install data files
install_dist: install everything from build directory
install_distinfo: create a .dist-info directory for the distribution
install_headers: install C/C++ header files
install_lib: install all Python modules (extensions and pure Python)
install_scripts: install scripts (Python or otherwise)
register: register the distribution with the Python package index
sdist: create a source distribution (tarball, zip file, etc.)
test: run the distribution's test suite
upload: upload distribution to PyPI
upload_docs: (no description available)