dpl 1.8.12.travis.1282.4 → 1.8.12.travis.1283.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTdlZTI5OWZmODY4NWJhY2Y0NDdhZjYwNWZiMmY4MTlkNzA3OGEzNg==
4
+ ODNhNWY3YTJlNGE0Mjk3ZjdlMmNmZGJhOWM0NmJkNjQ0ZDc4Zjg0NQ==
5
5
  data.tar.gz: !binary |-
6
- M2Y4MjNiNDZiMTEzNzhkYzUwMGEwNTY5M2ZkMzg0YTk2MWZiODUwMw==
6
+ MTc2MGZiM2U0ZmY3YjViNDMwZjIwM2ZhOGI2ZWUwN2JiYzI4MTZlNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YjU3M2VjNzdiMjY4N2UyNWRkMjI1ZTliNTNjZjE3MzgyMWQ5NzAyZmYzNzU1
10
- OTU5NGJmMmZhY2QwMzBhMzdjZWY3ZTYwOWMyMWVhZmFjZjZhMGZmMWIyMTZh
11
- OTYxN2RmYTY0MmRjN2EzYWFmYzg2Mzk5YTNlZDkwNjcwMGI1YTM=
9
+ NmU3ZTM5OGYyZDJmM2M2NjRkY2VlMzFiYjc0MjBhMThhNjZkZjEzZjBhY2E4
10
+ Mjg2YjgwMWY2YjllMDUzOTUzMTBiNTc0ZDc0M2I1YzI1NzJiNmMzZjNlOTRh
11
+ ZGFkMGViM2EyZjA5MzgyODgxYTNmNjZjMTg3MzcyNmE5NDk5MjQ=
12
12
  data.tar.gz: !binary |-
13
- ZWZmYmFhM2UyMzYxZTlmODg3OGE2OTcxZGM5MTQzZTc0MzZkMWUyNDQwNzNm
14
- YTRjZGExNDkzMzRiMmViMGU0ZGJkZjkzZDcwZmQxYTNjMTc0NGM3NjA5NWM2
15
- MjIwYTI5N2FjNDYyZGE0YmFmOTRhZmY1Mzk1MTIzNTYzNjE4Yjk=
13
+ NWM4NmQ1NjA4NmY0YTNmZDM4OTdiNjFmNWFlYTczOWUxYTk3YTY2MTUwOWYw
14
+ MTA5NTM4YWQ1YmRjNzY5ZDMyZDM5ZTUyOThlODRhNTRiZTk3NjI4YjU1N2Rh
15
+ MzljNDU0MzcxMDRmOTE3YmJiNGZjNmQ0NGZmYjQxMDU1ODIwOGE=
data/README.md CHANGED
@@ -291,9 +291,17 @@ For authentication you can also use Travis CI secure environment variable:
291
291
 
292
292
  * **user**: PyPI Username.
293
293
  * **password**: PyPI Password.
294
- * **server**: Optional. Only required if you want to release to a different index. Follows the form of "https://mypackageindex.com/index".
295
- * **distributions**: A space-separated list of distributions to be uploaded to PyPI. Defaults to 'sdist'.
296
- * **docs_dir**: A path to the directory to upload documentation from. Defaults to 'build/docs'
294
+ * **server**: Optional. Only required if you want to release to a different index. Follows the form of 'https://mypackageindex.com/index'. Defaults to 'https://pypi.python.org/pypi'.
295
+ * **distributions**: Optional. A space-separated list of distributions to be uploaded to PyPI. Defaults to 'sdist'.
296
+ * **docs_dir**: Optional. A path to the directory to upload documentation from. Defaults to 'build/docs'
297
+
298
+ #### Environment variables:
299
+
300
+ * **PYPI_USER**: PyPI Username. Used if the `user` option is omitted.
301
+ * **PYPI_PASSWORD**: PyPI Password. Used if the `password` option is omitted.
302
+ * **PYPI_SERVER** Optional. Only required if you want to release to a different index. Used if the `server` option is omitted.
303
+ * **PYPI_DISTRIBUTIONS** Optional. A space-separated list of distributions to be uploaded to PyPI. Used if the `distributions` option is omitted.
304
+ * **PYPI_DOCS_DIR** Optional. A path to the directory to upload documentation from. Used if the `docs_dir` option is omitted.
297
305
 
298
306
  #### Examples:
299
307
 
@@ -4,6 +4,29 @@ module DPL
4
4
  DEFAULT_SERVER = 'https://pypi.python.org/pypi'
5
5
  PYPIRC_FILE = '~/.pypirc'
6
6
 
7
+ def pypi_user
8
+ option(:username, :user) || context.env['PYPI_USER'] || context.env['PYPI_USERNAME']
9
+ end
10
+
11
+ def pypi_password
12
+ options[:password] || context.env['PYPI_PASSWORD']
13
+ end
14
+
15
+ def pypi_server
16
+ options[:server] || context.env['PYPI_SERVER'] || DEFAULT_SERVER
17
+ end
18
+
19
+ def pypi_distributions
20
+ options[:distributions] || context.env['PYPI_DISTRIBUTIONS'] || 'sdist'
21
+ end
22
+
23
+ def pypi_docs_dir_option
24
+ docs_dir = options[:docs_dir] || context.env['PYPI_DOCS_DIR'] || ''
25
+ if !docs_dir.empty?
26
+ '--upload-dir ' + docs_dir
27
+ end
28
+ end
29
+
7
30
  def self.install_setuptools
8
31
  shell 'wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python'
9
32
  shell 'rm -f setuptools-*.zip'
@@ -15,7 +38,7 @@ module DPL
15
38
 
16
39
  def initialize(*args)
17
40
  super(*args)
18
- self.class.pip 'wheel' if options[:distributions].to_s.include? 'bdist_wheel'
41
+ self.class.pip 'wheel' if pypi_distributions.to_s.include? 'bdist_wheel'
19
42
  end
20
43
 
21
44
  install_setuptools
@@ -27,9 +50,9 @@ module DPL
27
50
  :servers_line => 'index-servers = pypi',
28
51
  :servers => {
29
52
  'pypi' => [
30
- "repository: #{options[:server] || DEFAULT_SERVER}",
31
- "username: #{option(:user)}",
32
- "password: #{option(:password)}",
53
+ "repository: #{pypi_server}",
54
+ "username: #{pypi_user}",
55
+ "password: #{pypi_password}",
33
56
  ]
34
57
  }
35
58
  }
@@ -56,8 +79,10 @@ module DPL
56
79
  end
57
80
 
58
81
  def check_auth
82
+ error "missing PyPI username" unless pypi_user
83
+ error "missing PyPI password" unless pypi_password
59
84
  write_config
60
- log "Authenticated as #{option(:user)}"
85
+ log "Authenticated as #{pypi_user}"
61
86
  end
62
87
 
63
88
  def check_app
@@ -68,15 +93,10 @@ module DPL
68
93
  end
69
94
 
70
95
  def push_app
71
- context.shell "python setup.py #{options[:distributions] || 'sdist'}"
96
+ context.shell "python setup.py #{pypi_distributions}"
72
97
  context.shell "twine upload -r pypi dist/*"
73
98
  context.shell "rm -rf dist/*"
74
- if options[:docs_dir]
75
- docs_dir_option = '--upload-dir ' + options[:docs_dir]
76
- else
77
- docs_dir_option = ''
78
- end
79
- context.shell "python setup.py upload_docs #{docs_dir_option} -r #{options[:server] || 'pypi'}"
99
+ context.shell "python setup.py upload_docs #{pypi_docs_dir_option} -r #{pypi_server}"
80
100
  end
81
101
  end
82
102
  end
@@ -32,7 +32,7 @@ describe DPL::Provider::PyPI do
32
32
  expect(provider.context).to receive(:shell).with("python setup.py sdist")
33
33
  expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*")
34
34
  expect(provider.context).to receive(:shell).with("rm -rf dist/*")
35
- expect(provider.context).to receive(:shell).with("python setup.py upload_docs -r pypi")
35
+ expect(provider.context).to receive(:shell).with("python setup.py upload_docs -r https://pypi.python.org/pypi")
36
36
  provider.push_app
37
37
  end
38
38
 
@@ -41,7 +41,7 @@ describe DPL::Provider::PyPI do
41
41
  expect(provider.context).to receive(:shell).with("python setup.py sdist bdist")
42
42
  expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*")
43
43
  expect(provider.context).to receive(:shell).with("rm -rf dist/*")
44
- expect(provider.context).to receive(:shell).with("python setup.py upload_docs -r pypi")
44
+ expect(provider.context).to receive(:shell).with("python setup.py upload_docs -r https://pypi.python.org/pypi")
45
45
  provider.push_app
46
46
  end
47
47
 
@@ -59,7 +59,7 @@ describe DPL::Provider::PyPI do
59
59
  expect(provider.context).to receive(:shell).with("python setup.py sdist")
60
60
  expect(provider.context).to receive(:shell).with("twine upload -r pypi dist/*")
61
61
  expect(provider.context).to receive(:shell).with("rm -rf dist/*")
62
- expect(provider.context).to receive(:shell).with("python setup.py upload_docs --upload-dir some/dir -r pypi")
62
+ expect(provider.context).to receive(:shell).with("python setup.py upload_docs --upload-dir some/dir -r https://pypi.python.org/pypi")
63
63
  provider.push_app
64
64
  end
65
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.12.travis.1282.4
4
+ version: 1.8.12.travis.1283.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase