У меня есть файл требований, в котором я устанавливаю несколько пакетов. Когда я запускаю pip install
в первый раз в новой среде, они устанавливаются так, как должны. После этого большинство моих пакетов правильно сообщают «Требование уже выполнено» и не устанавливаются снова.Почему каждый раз, когда он запускается, «устанавливайте собранные пакеты»?
Однако один из моих пакетов по какой-то причине является «Установка собранных пакетов» каждый раз, выполняя setup.py и т. Д. Это фактически моя собственная внутренняя библиотека, размещенная на моем собственном сервере и устанавливаемая через git + SSH.
Вот посмотрите, что происходит. (Библиотека называется Джанго-дополнение.)
$ pip install -r requirements/production.txt
Requirement already satisfied (use --upgrade to upgrade): django from git+https://github.com/django/[email protected]#egg=django in ./lib/python2.7/site-packages (from -r requirements/production.txt (line 3))
Downloading/unpacking django- from git+ssh://XXXXXXXX/gits/[email protected]#egg=django_supplement (from -r requirements/production.txt (line 4))
Cloning ssh://XXXXXXXX/gits/django_supplement (to 1.6) to ./build/django-supplement
Running setup.py egg_info for package django-supplement
Requirement already satisfied (use --upgrade to upgrade): mailsnake from git+https://github.com/Leftium/mailsnake.git#egg=mailsnake in ./lib/python2.7/site-packages (from -r requirements/production.txt (line 5))
Requirement already satisfied (use --upgrade to upgrade): MySQL-python==1.2.4 in ./lib/python2.7/site-packages (from -r requirements/common.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): South==0.7.3 in ./lib/python2.7/site-packages (from -r requirements/common.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): python-memcached==1.47 in ./lib/python2.7/site-packages (from -r requirements/common.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): django-model-utils==1.0.0 in ./lib/python2.7/site-packages (from -r requirements/common.txt (line 5))
Requirement already satisfied (use --upgrade to upgrade): django-localflavor==1.0 in ./lib/python2.7/site-packages (from -r requirements/common.txt (line 6))
Requirement already satisfied (use --upgrade to upgrade): django-countries==1.0.5 in ./lib/python2.7/site-packages (from -r requirements/common.txt (line 7))
Requirement already satisfied (use --upgrade to upgrade): gunicorn==18.0 in ./lib/python2.7/site-packages (from -r requirements/common.txt (line 9))
Requirement already satisfied (use --upgrade to upgrade): wsgiref==0.1.2 in /usr/lib/python2.7 (from -r requirements/common.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): markdown2>=1.0.1.19 in ./lib/python2.7/site-packages (from django-supplement->-r requirements/production.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): distribute in ./lib/python2.7/site-packages (from mailsnake->-r requirements/production.txt (line 5))
Requirement already satisfied (use --upgrade to upgrade): setuptools>=0.7 in ./lib/python2.7/site-packages (from distribute->mailsnake->-r requirements/production.txt (line 5))
Installing collected packages: django-supplement
Running setup.py install for django-supplement
Successfully installed django-supplement
Cleaning up...
А вот что setup.py выглядит в Джанго-дополнения:
import os
from setuptools import setup, find_packages
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "django_supplement",
version = "1.6.1",
author = "Jim Dalton",
author_email = "XXXXXXXX",
description = "Common helpers for django",
license = "BSD",
packages=find_packages(),
long_description=read('README'),
install_requires=["markdown2 >= 1.0.1.19"],
)
Так что я хотел бы сделать, это найти способ заставьте мою библиотеку вести себя как обычные библиотеки и установите один раз для данной версии и в противном случае сообщите «Требование уже удовлетворено», если я не использую флаг -upgrade или что-то еще.
FYI причина, по которой я забочусь, заключается в том, что я сейчас настраиваю проект в Ansible, и тот факт, что он сообщает «Успешно установленный», заставляет Ansible думать, что произошли изменения, которые запускают другие действия I избегать во время настройки.