Date:
2011-04-23
Tags:
python
packaging (aka Distutils2) のcreateコマンド
(第7回)Python mini Hack-a-thon 夕方の部
Python-3.3 に標準搭載されるpackaging(Python3.3未満ではDistutils2)を試す で pysetup を使えるようになったので、コマンドを少しずつ見ていきます。
pysetup commands
$ python bin/pysetup
Usage: pysetup [options] action [action_options]
Actions:
. 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
まずはプロジェクト作成のための create
コマンドをたたいてみます。
pysetup create
$ python bin/pysetup create
Project name [du2]: spam
Current version number: 0.5
Package summary:
Author name: shimizukawa
Author e-mail address: shimizukawa
Project Home Page: none
Do you want me to automatically build the file list with everything I can find
in the current directory ? If you say no, you will have to define them manually
. (y/n): y
Do you want to set Trove classifiers? (y/n): y
Please select the project status:
1 - Planning
2 - Pre-Alpha
3 - Alpha
4 - Beta
5 - Production/Stable
6 - Mature
7 - Inactive
Status: 4
What license do you use: BSD
Matching licenses:
1) License :: OSI Approved :: BSD License
Type the number of the license you wish to use or ? to try again:: 1
Do you want to set other trove identifiers (y/n) [n]: n
Wrote "setup.cfg".
$ ls
bin lib setup.cfg
上記のように、対話型で実行され、最終的には setup.cfg
が生成されました。
setup.cfgの中身はこんな感じ:
[metadata]
name = spam
version = 0.5
summary = ham ham ham
download_url = UNKNOWN
home_page = none
author = shimizukawa
author_email = shimizukawa
classifier = License :: OSI Approved :: BSD License
Development Status :: 4 - Beta
[files]
packages =
modules =
resources =
なるほど、でもsetup.pyは作ってくれないんですね.. その辺りの仕組みも違うのかな?
ちなみに、既存のプロジェクトディレクトリで pysetup create
を実行すると、以下のように setup.py から自動変換してくれるようです。便利ですね。
pysetup create
$ pysetup create
A legacy setup.py has been found.
Would you like to convert it to a setup.cfg ? (y/n)