lib/dpl/provider/pypi.rb in dpl-1.8.46.travis.2449.5 vs lib/dpl/provider/pypi.rb in dpl-1.8.46.travis.2451.5
- old
+ new
@@ -30,27 +30,17 @@
def skip_upload_docs?
! options.has_key?(:skip_upload_docs) ||
(options.has_key?(:skip_upload_docs) && options[:skip_upload_docs])
end
- def self.install_setuptools
- shell 'wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python'
- shell 'rm -f setuptools-*.zip'
+ def install_deploy_dependencies
+ unless context.shell "wget -O - https://bootstrap.pypa.io/get-pip.py | python - --no-setuptools --no-wheel && " \
+ "pip install --upgrade setuptools twine wheel"
+ error "Couldn't install pip, setuptools, twine or wheel."
+ end
end
- def self.install_twine
- shell("pip install twine", retry: true) if `which twine`.chop.empty?
- end
-
- def initialize(*args)
- super(*args)
- self.class.pip 'wheel' if pypi_distributions.to_s.include? 'bdist_wheel'
- end
-
- install_setuptools
- install_twine
-
def config
{
:header => '[distutils]',
:servers_line => 'index-servers = pypi',
:servers => {
@@ -97,10 +87,12 @@
false
end
def push_app
context.shell "python setup.py #{pypi_distributions}"
- context.shell "twine upload -r pypi dist/*"
+ unless context.shell "twine upload -r pypi dist/*"
+ error 'PyPI upload failed.'
+ end
context.shell "rm -rf dist/*"
unless skip_upload_docs?
log "Uploading documentation (skip with \"skip_upload_docs: true\")"
context.shell "python setup.py upload_docs #{pypi_docs_dir_option} -r #{pypi_server}"
end