我有一个需求文件,我正在安装多个软件包。当我第一次在新环境中运行pip install
时,他们会按照自己的意愿安装。此后,我的大多数软件包都正确报告“需求已满足”,而不是再次安装。
但是,由于某种原因,我的一个软件包是“每次安装收集的软件包”,执行setup.py等。这实际上是我自己的内部库,它托管在我自己的服务器上并通过git + ssh安装
以下是对正在发生的事情的看法。 (该库名为django-supplement。)
$ pip install -r requirements/production.txt
Requirement already satisfied (use --upgrade to upgrade): django from git+https://github.com/django/django.git@1.6b2#egg=django in ./lib/python2.7/site-packages (from -r requirements/production.txt (line 3))
Downloading/unpacking django- from git+ssh://XXXXXXXX/gits/django_supplement@1.6#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...
这就是django-supplement中的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标志或其他。
仅供参考,我关心的原因是我现在正在Ansible中配置一个项目,而且报告“成功安装......”这一事实导致Ansible认为发生了变化,触发了其他行动。 d在配置期间更愿意避免。
答案 0 :(得分:0)
好吧,我解决了这个问题,但我不确定原因。我想传递给设置的名字kwarg我想是没有与某些东西对齐。重命名为django-supplement解决了这个问题。