为什么我的包没有拉下download_url

时间:2013-07-13 05:43:55

标签: python distutils setup.py

我想转而使用新的GitHub Releases作为我的包。我无法弄清楚我的download_url需要做什么。版本为1.3.5我尝试了releases/tag/1.3.5archive/1.3.5archive/1.3.5#egg=v1.3.5的各种版本无效。

我的问题是,在阅读PEP 438时 - 我知道它正在寻找simple-history-v1.3.5.EXT但是我可以强制setup.py使用特定的网址吗?

from setuptools import find_packages, setup
from simple_history import __version__

base_url = 'https://github.com/pivotal-energy-solutions/django-simple-history'

setup(name='simple_history',
      version=__version__,
      description='Store Django model history with the ability to revert back to a '
                  'specific change at any time. This includes capturing request.user',
      author='Steven Klass',
      author_email='sklass@pivotalenergysolutions.com',
      url=base_url,
      download_url='{0}/archive/{1}.tar.gz'.format(base_url, __version__),
      license='Apache License (2.0)',
      classifiers=[
          'Development Status :: 2 - Pre-Alpha',
          'Environment :: Web Environment',
          'Framework :: Django',
          'Intended Audience :: Developers',
          'License :: OSI Approved :: Apache Software License',
          'Operating System :: OS Independent',
          'Programming Language :: Python',
          'Topic :: Software Development',
      ],
      packages=find_packages(exclude=['tests', 'tests.*']),
      package_data={'simple_history': ['static/js/*.js', 'templates/simple_history/*.html']},
      include_package_data=True,
      zip_safe=False,
      requires=['django (>=1.2)', ],
)

当我做一个简单的安装时,它说它找到它但它总是回到1.1版。有人可以告诉我我的问题。

$ easy_install -vvv simple_history
Searching for simple-history
Reading http://pypi.python.org/simple/simple_history/
Reading https://github.com/pivotal-energy-solutions/django-simple-history
Found link: https://github.com/pivotal-energy-solutions/django-simple-history/archive/master.zip
Found link: https://github.com/pivotal-energy-solutions/django-simple-history/archive/1.3.5.tar.gz
Found link: https://github.com/pivotal-energy-solutions/django-simple-history/archive/v1.3.3.tar.gz
Found link: https://pypi.python.org/packages/source/s/simple_history/simple_history-1.1.tar.gz#md5=b4c4bb2512904d7826a75f58cc9df651
Found link: https://pypi.python.org/packages/source/s/simple_history/simple_history-v1.3.3.tar.gz#md5=1564e23e982553b76a4ed7328fb5b812
Best match: simple-history 1.1

1 个答案:

答案 0 :(得分:3)

请为您的发布simple-history-1.3.5.tar.gz下载1.3.5;换句话说'{0}-{1}{2}'.format(packagename, version, ext))。有关setuptools.package_index.interpret_distro_name尝试解析网址easy_install的方式的参考,请参阅basename


更新

换句话说,如果将您在GitHub上的版本命名为<pypi package>-<version>。如果您只是将download_url更改为

,则可以自动获取它
download_url='{0}/releases'.format(base_url)
# or 
package_name='simple_history' # define it before setup()
download_url='{0}/archive/{1}-{2}'.format(base_url, package_name, __version__)