Бих искал да мога да добавя кука към моя setup.py, която ще се изпълнява след инсталиране (или при easy_install'ing, или когато правя python setup.py install).
В моя проект, PySmell, имам някои файлове за поддръжка за Vim и Emacs. Когато потребителят инсталира PySmell по обичайния начин, тези файлове се копират в действителното яйце и потребителят трябва да ги извади и постави в своите .vim или .emacs директории. Това, което искам, е или да попитам потребителя, след инсталирането, къде би искал тези файлове да бъдат копирани, или дори просто съобщение, отпечатващо местоположението на файловете и какво трябва да прави с тях.
Кой е най-добрият начин да направите това?
Благодаря
Моят setup.py изглежда така:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from setuptools import setup
version = __import__('pysmell.pysmell').pysmell.__version__
setup(
name='pysmell',
version = version,
description = 'An autocompletion library for Python',
author = 'Orestis Markou',
author_email = '[email protected]',
packages = ['pysmell'],
entry_points = {
'console_scripts': [ 'pysmell = pysmell.pysmell:main' ]
},
data_files = [
('vim', ['pysmell.vim']),
('emacs', ['pysmell.el']),
],
include_package_data = True,
keywords = 'vim autocomplete',
url = 'http://code.google.com/p/pysmell',
long_description =
"""\
PySmell is a python IDE completion helper.
It tries to statically analyze Python source code, without executing it,
and generates information about a project's structure that IDE tools can
use.
The first target is Vim, because that's what I'm using and because its
completion mechanism is very straightforward, but it's not limited to it.
""",
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development',
'Topic :: Utilities',
'Topic :: Text Editors',
]
)
РЕДАКТИРАНЕ:
Ето мъниче, което демонстрира python setup.py install
:
from setuptools.command.install import install as _install
class install(_install):
def run(self):
_install.run(self)
print post_install_message
setup(
cmdclass={'install': install},
...
Все още няма късмет с маршрута easy_install.
setuptools.install.install:run()
изрично не разрешава аргумента за настройкаinstall_requires
и изглежда, че работи по различен начин, когато направите това - person astronaut   schedule 22.09.2013do_egg_install
, както е обсъдено тук: stackoverflow.com/questions/21915469/ - person Ioannis Filippidis   schedule 27.03.2015