Я думаю, что короткий ответ, "потому что это имеет нулевую полноценность". Для вызова метода интерфейса Вам нужен экземпляр типа. От методов экземпляра можно назвать любые статические методы, Вы хотите.
I know you know much of this, Brandon, but I'll try to give as a complete answer as I can (although I'm no setuptools gury) for the benefit of others.
The problem here is that setuptools itself involves quite a lot of black magick, including using an entry point called setuptools.file_finders where you can add plugins to find files to include. I am, however, at a complete loss as to how REMOVE plugins from it...
Quick workaround: svn export your package to a temporary directory and run the setup.py from there. That means you have no svn, so the svn finder finds no files to include. :)
Longer workaround: Do you really need setuptools? Setuptools have a lot of features, so the answer is likely yes, but mainly those features are depdenencies (so your dependencies get installed by easy_install), namespace packages (foo.bar), and entry points. Namespace packages can actually be created without setuptools as well. But if you use none of these you might actually get away with just using distutils.
Ugly workaround: The monkeypatch you gave to sdist in your question, which simply makes the plugin not have any finders, and exit quickly.
So as you see, this answer, although as complete as I can make it, is still embarrassingly incomplete. I can't actually answer your question, though I think the answer is "You can't".
Я бы сказал, что поведение sdist по умолчанию правильное. Когда вы создаете исходный дистрибутив, я ожидаю, что он будет содержать все , что проверено в Subversion. Конечно, было бы неплохо иметь возможность полностью переопределить его при особых обстоятельствах.
Сравните sdist с bdist_egg; Готов поспорить, будут включены только те файлы, которые указаны явно.
Я провел простой тест с тремя файлами, все в svn. Пустые файлы dummy.lkj и foobar.py и setup.py выглядят так:
import setuptools
setuptools.setup(name='foobar', version='0.1', py_modules=['foobar'])
sdist создает архив, содержащий dummy.lkj. bdist_egg создает яйцо без файла dummy.lkj.
Вероятно, ответ находится в вашем setup.py. Вы используете find_packages? Эта функция по умолчанию использует VCS (например, subversion, hg, ...). Если вам это не нравится, просто напишите другую функцию Python, которая будет собирать только то, что вам нужно.
Вы, вероятно, захотите что-то вроде этого:
from distutils.core import setup
def packages():
import os
packages = []
for path, dirs, files in os.walk("yourprogram"):
if ".svn" in dirs:
dirs.remove(".svn")
if "__init__.py" in files:
packages.append(path.replace(os.sep, "."))
return packages
setup(
# name, version, description, etc...
packages = packages(),
# pacakge_data, data_files, etc...
)
Создайте файл MANIFEST.in с помощью:
recursive-exclude .
# other MANIFEST.in commands go here
# to explicitly include whatever files you want
См. http://docs.python.org/distutils/commandref.html#sdist-cmd для МАНИФЕСТА .in синтаксис.