poise-python 1.5.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +25 -3
  3. data/CHANGELOG.md +7 -0
  4. data/Gemfile +1 -1
  5. data/README.md +1 -1
  6. data/Rakefile +1 -1
  7. data/chef/attributes/default.rb +1 -1
  8. data/chef/recipes/default.rb +1 -1
  9. data/lib/poise_python.rb +1 -1
  10. data/lib/poise_python/cheftie.rb +1 -1
  11. data/lib/poise_python/error.rb +1 -1
  12. data/lib/poise_python/python_command_mixin.rb +1 -1
  13. data/lib/poise_python/python_providers.rb +1 -1
  14. data/lib/poise_python/python_providers/base.rb +1 -1
  15. data/lib/poise_python/python_providers/dummy.rb +1 -1
  16. data/lib/poise_python/python_providers/msi.rb +1 -1
  17. data/lib/poise_python/python_providers/portable_pypy.rb +2 -2
  18. data/lib/poise_python/python_providers/portable_pypy3.rb +18 -2
  19. data/lib/poise_python/python_providers/scl.rb +1 -1
  20. data/lib/poise_python/python_providers/system.rb +1 -1
  21. data/lib/poise_python/resources.rb +1 -1
  22. data/lib/poise_python/resources/pip_requirements.rb +1 -1
  23. data/lib/poise_python/resources/python_execute.rb +1 -1
  24. data/lib/poise_python/resources/python_package.rb +45 -10
  25. data/lib/poise_python/resources/python_runtime.rb +1 -1
  26. data/lib/poise_python/resources/python_runtime_pip.rb +8 -2
  27. data/lib/poise_python/resources/python_runtime_test.rb +3 -3
  28. data/lib/poise_python/resources/python_virtualenv.rb +3 -2
  29. data/lib/poise_python/utils.rb +1 -1
  30. data/lib/poise_python/utils/python_encoder.rb +1 -1
  31. data/lib/poise_python/version.rb +2 -2
  32. data/poise-python.gemspec +2 -2
  33. data/test/cookbook/metadata.rb +1 -1
  34. data/test/cookbook/recipes/default.rb +1 -1
  35. data/test/gemfiles/chef-12.1.gemfile +4 -1
  36. data/test/gemfiles/chef-12.10.gemfile +4 -1
  37. data/test/gemfiles/chef-12.11.gemfile +4 -1
  38. data/test/gemfiles/chef-12.12.gemfile +4 -1
  39. data/test/gemfiles/chef-12.13.gemfile +4 -1
  40. data/test/gemfiles/chef-12.14.gemfile +19 -0
  41. data/test/gemfiles/chef-12.15.gemfile +19 -0
  42. data/test/gemfiles/chef-12.16.gemfile +19 -0
  43. data/test/gemfiles/chef-12.17.gemfile +19 -0
  44. data/test/gemfiles/chef-12.18.gemfile +19 -0
  45. data/test/gemfiles/chef-12.19.gemfile +19 -0
  46. data/test/gemfiles/chef-12.2.gemfile +4 -1
  47. data/test/gemfiles/chef-12.3.gemfile +4 -1
  48. data/test/gemfiles/chef-12.4.gemfile +5 -2
  49. data/test/gemfiles/chef-12.5.gemfile +4 -1
  50. data/test/gemfiles/chef-12.6.gemfile +4 -1
  51. data/test/gemfiles/chef-12.7.gemfile +4 -1
  52. data/test/gemfiles/chef-12.8.gemfile +4 -1
  53. data/test/gemfiles/chef-12.9.gemfile +4 -1
  54. data/test/gemfiles/chef-12.gemfile +2 -2
  55. data/test/gemfiles/chef-13.0.gemfile +19 -0
  56. data/test/gemfiles/chef-13.gemfile +19 -0
  57. data/test/gemfiles/master.gemfile +2 -1
  58. data/test/integration/default/serverspec/default_spec.rb +5 -3
  59. data/test/spec/python_command_mixin_spec.rb +10 -10
  60. data/test/spec/python_providers/dummy_spec.rb +1 -1
  61. data/test/spec/python_providers/portable_pypy3_spec.rb +14 -3
  62. data/test/spec/python_providers/portable_pypy_spec.rb +3 -3
  63. data/test/spec/python_providers/scl_spec.rb +1 -1
  64. data/test/spec/python_providers/system_spec.rb +1 -1
  65. data/test/spec/resources/pip_requirements_spec.rb +1 -1
  66. data/test/spec/resources/python_package_spec.rb +31 -4
  67. data/test/spec/resources/python_runtime_pip_spec.rb +1 -1
  68. data/test/spec/resources/python_runtime_spec.rb +1 -1
  69. data/test/spec/resources/python_virtualenv_spec.rb +20 -2
  70. data/test/spec/spec_helper.rb +1 -1
  71. data/test/spec/utils/python_encoder_spec.rb +1 -1
  72. data/test/spec/utils_spec.rb +1 -1
  73. metadata +27 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f304a2454721479e3c38acad468e98a2774757e
4
- data.tar.gz: b232e65292bf44a165365aff618bf43eba398fcb
3
+ metadata.gz: ce39dfd6c5b8b8003f462ba7893cfb9ef0ae169f
4
+ data.tar.gz: 8ffe437521b352b6921d35312a8be893d85772ad
5
5
  SHA512:
6
- metadata.gz: 78e693a8d1fdb7d0928ffc6946fbcc4c229bddc9b492999cc4067ae6f8ae7f51a77197a1863567a02056429864806febf39d7914f75b4ce6371b6d6710c59c82
7
- data.tar.gz: 73957a301bf9c69bde856b5afedc5f7628a0d31e8d3c4166d9e68bd210293c0d4ad557eba770a955f8671aef69dbd8feddc6acbac65be9574f349d023df4c818
6
+ metadata.gz: de2552c9e02388871d91dd02a10655aeb975be311fc4518ab594ffcd6e32e674275ca907bd5d8a978473634fabf8eaeefaec4a07c75255204fdb838d814dd9aa
7
+ data.tar.gz: cc89c455a9e4a13353e4fb1b79bbe6a3c3daa24bf3c466f1c39789d710718b0511debd9a66b98fe28ee38a546537e367950469e3d4525ac03331b477d3761cfa
@@ -4,14 +4,22 @@ language: ruby
4
4
  env:
5
5
  global:
6
6
  - secure: j4GV/0NXC6p/+XxgK2isMCzccR7ry8cxLJZZbJN5P+958lLGmYtPPsfAN+aRzcR3Uc/alLcsjXvceCjJWU7qYpkN1x9cn564J1X3OIOygi6xdYQIMLL5Guxp01QYabFlrmZeUnTVMTkdR1H4aRrpzW4kTuc5hbIZaJl0enEe1Dd+vbCw2GOTXFnPTeLDCaCSNXXhXmqqWD64leFR2PTwx8fwrXyCB/bDRXhFdsFA5Q/tCGW7PDaYujbqSCegpuz+uvHoM5S2k2XY3pShWZm9WcmEzCLEfhOGCc1s+ia7TZ0iV7kzEq11mNTdSl6nJtBUiKsgqw1TRPFhhUj2Bp/K+cNsd06rtFE3In2zbqbgyJ0qnyQHs2FZO//ve8bug+B0lA3i6SantruS1Fc9NjwjqzOmqmaqNhnVl1jEQTOB3JUC465QShySF0aJtjE5khD7PzGwCw6cqhPBLH5ZTmqCYvl/egYLMlvVr1Nboa+0YFdzUqoTFJpRTsu89l8+1+Eu9pvHn0CwsjWmEVHahIw/GEBjhLPDinquJNxWz1q49ozlohntbRmWhbgzz6D4wPrbBdyW7rYm8p6d2sOy6Op2zsVv4c7Dj3pcLLd9J5o6RaNxf4wLd5VFLNJR6/wldsZXGxV/iP16oyasabYIQYZNbP0U1hZiUpLQ5cvKYc6xRTM=
7
- before_install: gem install bundler
8
- bundler_args: '--binstubs=$PWD/bin --jobs 3 --retry 3'
7
+ before_install:
8
+ - 'if [[ $BUNDLE_GEMFILE == *master.gemfile ]]; then gem update --system; fi'
9
+ - gem --version
10
+ - gem install bundler
11
+ - bundle --version
12
+ - 'bundle config --local path ${BUNDLE_PATH:-$(dirname $BUNDLE_GEMFILE)/vendor/bundle}'
13
+ - bundle config --local bin $PWD/bin
14
+ install: bundle update --jobs=3 --retry=3
9
15
  script:
10
16
  - ./bin/rake travis
11
17
  matrix:
12
18
  include:
13
- - rvm: 2.1.9
19
+ - rvm: 2.3.1
14
20
  gemfile: test/gemfiles/chef-12.gemfile
21
+ - rvm: 2.4.1
22
+ gemfile: test/gemfiles/chef-13.gemfile
15
23
  - rvm: 2.1.4
16
24
  gemfile: test/gemfiles/chef-12.1.gemfile
17
25
  - rvm: 2.1.4
@@ -39,4 +47,18 @@ matrix:
39
47
  - rvm: 2.1.9
40
48
  gemfile: test/gemfiles/chef-12.13.gemfile
41
49
  - rvm: 2.3.1
50
+ gemfile: test/gemfiles/chef-12.14.gemfile
51
+ - rvm: 2.3.1
52
+ gemfile: test/gemfiles/chef-12.15.gemfile
53
+ - rvm: 2.3.1
54
+ gemfile: test/gemfiles/chef-12.16.gemfile
55
+ - rvm: 2.3.1
56
+ gemfile: test/gemfiles/chef-12.17.gemfile
57
+ - rvm: 2.3.1
58
+ gemfile: test/gemfiles/chef-12.18.gemfile
59
+ - rvm: 2.3.1
60
+ gemfile: test/gemfiles/chef-12.19.gemfile
61
+ - rvm: 2.4.1
62
+ gemfile: test/gemfiles/chef-13.0.gemfile
63
+ - rvm: 2.4.1
42
64
  gemfile: test/gemfiles/master.gemfile
@@ -1,5 +1,12 @@
1
1
  # Poise-Python Changelog
2
2
 
3
+ ## v1.6.0
4
+
5
+ * Improved handling for Python 3.3.
6
+ * Updated PyPy release lists.
7
+ * Fix file permissions for non-root-owned virtualenvs.
8
+ * Support for Chef 13.
9
+
3
10
  ## v1.5.1
4
11
 
5
12
  * Fix handling of packages with underscores in the name.
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -435,7 +435,7 @@ The Poise test server infrastructure is sponsored by [Rackspace](https://rackspa
435
435
 
436
436
  ## License
437
437
 
438
- Copyright 2015-2016, Noah Kantrowitz
438
+ Copyright 2015-2017, Noah Kantrowitz
439
439
 
440
440
  Licensed under the Apache License, Version 2.0 (the "License");
441
441
  you may not use this file except in compliance with the License.
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2016, Noah Kantrowitz
2
+ # Copyright 2016-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@ module PoisePython
26
26
  provides(:portable_pypy)
27
27
  include PoiseLanguages::Static(
28
28
  name: 'pypy',
29
- versions: %w{4.0.1 2.6.1 2.5.1 2.5 2.4 2.3.1 2.3 2.2.1 2.2 2.1 2.0.2},
29
+ versions: %w{5.7.1 5.6 5.4.1 5.4 5.3.1 5.1.1 5.1 5.0.1 5.0 4.0.1 2.6.1 2.5.1 2.5 2.4 2.3.1 2.3 2.2.1 2.2 2.1 2.0.2},
30
30
  machines: %w{linux-i686 linux-x86_64},
31
31
  url: 'https://bitbucket.org/squeaky/portable-pypy/downloads/pypy-%{version}-%{kernel}_%{machine}-portable.tar.bz2'
32
32
  )
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -26,11 +26,27 @@ module PoisePython
26
26
  provides(:portable_pypy3)
27
27
  include PoiseLanguages::Static(
28
28
  name: 'pypy3',
29
- versions: %w{2.4 2.3.1},
29
+ # Don't put prereleases first so they aren't used for prefix matches on ''.
30
+ versions: %w{2.4 5.7.1-beta 5.7-beta 5.5-alpha-20161014 5.5-alpha-20161013 5.2-alpha-20160602 2.3.1},
30
31
  machines: %w{linux-i686 linux-x86_64},
31
32
  url: 'https://bitbucket.org/squeaky/portable-pypy/downloads/pypy3-%{version}-%{kernel}_%{machine}-portable.tar.bz2'
32
33
  )
33
34
 
35
+ def self.default_inversion_options(node, resource)
36
+ super.tap do |options|
37
+ if resource.version && resource.version =~ /^(pypy3-)?5(\.\d)?/
38
+ # We need a different default base URL for pypy3.3
39
+ # This is the same as before but `/pypy3.3` as the prefix on the filename.
40
+ basename = if $2 == '.2' || $2 == '.5'
41
+ 'pypy3.3'
42
+ else
43
+ 'pypy3.5'
44
+ end
45
+ options['url'] = "https://bitbucket.org/squeaky/portable-pypy/downloads/#{basename}-%{version}-%{kernel}_%{machine}-portable.tar.bz2"
46
+ end
47
+ end
48
+ end
49
+
34
50
  def python_binary
35
51
  ::File.join(static_folder, 'bin', 'pypy')
36
52
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -99,19 +99,19 @@ EOH
99
99
  # @!attribute group
100
100
  # System group to install the package.
101
101
  # @return [String, Integer, nil]
102
- attribute(:group, kind_of: [String, Integer, NilClass])
102
+ attribute(:group, kind_of: [String, Integer, NilClass], default: lazy { default_group })
103
103
  # @!attribute install_options
104
104
  # Options string to be used with `pip install`.
105
- # @return [String, nil, false]
106
- attribute(:install_options, kind_of: [String, NilClass, FalseClass], default: nil)
105
+ # @return [String, Array<String>, nil, false]
106
+ attribute(:install_options, kind_of: [String, Array, NilClass, FalseClass], default: nil)
107
107
  # @!attribute list_options
108
108
  # Options string to be used with `pip list`.
109
- # @return [String, nil, false]
110
- attribute(:list_options, kind_of: [String, NilClass, FalseClass], default: nil)
109
+ # @return [String, Array<String>, nil, false]
110
+ attribute(:list_options, kind_of: [String, Array, NilClass, FalseClass], default: nil)
111
111
  # @!attribute user
112
112
  # System user to install the package.
113
113
  # @return [String, Integer, nil]
114
- attribute(:user, kind_of: [String, Integer, NilClass])
114
+ attribute(:user, kind_of: [String, Integer, NilClass], default: lazy { default_user })
115
115
 
116
116
  def initialize(*args)
117
117
  super
@@ -141,6 +141,35 @@ EOH
141
141
  def source(arg=nil)
142
142
  raise NoMethodError if arg
143
143
  end
144
+
145
+ private
146
+
147
+ # Find a default group, if any, from the parent Python.
148
+ #
149
+ # @api private
150
+ # @return [String, Integer, nil]
151
+ def default_group
152
+ # Use an explicit is_a? hack because python_runtime is a container so
153
+ # it gets the whole DSL and this will always respond_to?(:group).
154
+ if parent_python && parent_python.is_a?(PoisePython::Resources::PythonVirtualenv::Resource)
155
+ parent_python.group
156
+ else
157
+ nil
158
+ end
159
+ end
160
+
161
+ # Find a default user, if any, from the parent Python.
162
+ #
163
+ # @api private
164
+ # @return [String, Integer, nil]
165
+ def default_user
166
+ # See default_group for explanation of is_a? hack grossness.
167
+ if parent_python && parent_python.is_a?(PoisePython::Resources::PythonVirtualenv::Resource)
168
+ parent_python.user
169
+ else
170
+ nil
171
+ end
172
+ end
144
173
  end
145
174
 
146
175
  # The default provider for the `python_package` resource.
@@ -268,9 +297,15 @@ EOH
268
297
  runner = opts.delete(:pip_runner) || %w{-m pip.__main__}
269
298
  type_specific_options = new_resource.send(:"#{options_type}_options")
270
299
  full_cmd = if new_resource.options || type_specific_options
271
- # We have to use a string for this case to be safe because the
272
- # options are a string and I don't want to try and parse that.
273
- "#{runner.join(' ')} #{pip_command} #{new_resource.options} #{type_specific_options} #{Shellwords.join(pip_options)}"
300
+ if (new_resource.options && new_resource.options.is_a?(String)) || (type_specific_options && type_specific_options.is_a?(String))
301
+ # We have to use a string for this case to be safe because the
302
+ # options are a string and I don't want to try and parse that.
303
+ global_options = new_resource.options.is_a?(Array) ? Shellwords.join(new_resource.options) : new_resource.options.to_s
304
+ type_specific_options = type_specific_options.is_a?(Array) ? Shellwords.join(type_specific_options) : type_specific_options.to_s
305
+ "#{runner.join(' ')} #{pip_command} #{global_options} #{type_specific_options} #{Shellwords.join(pip_options)}"
306
+ else
307
+ runner + (pip_command ? [pip_command] : []) + (new_resource.options || []) + (type_specific_options || []) + pip_options
308
+ end
274
309
  else
275
310
  # No special options, use an array to skip the extra /bin/sh.
276
311
  runner + (pip_command ? [pip_command] : []) + pip_options
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
+ require 'fileutils'
17
18
  require 'tempfile'
18
19
 
19
20
  require 'chef/resource'
@@ -122,7 +123,12 @@ module PoisePython
122
123
  boostrap_cmd = [new_resource.parent.python_binary, temp.path, '--upgrade', '--force-reinstall']
123
124
  boostrap_cmd << "pip==#{new_resource.version}" if new_resource.version
124
125
  Chef::Log.debug("[#{new_resource}] Running pip bootstrap command: #{boostrap_cmd.join(' ')}")
125
- poise_shell_out!(boostrap_cmd, environment: new_resource.parent.python_environment.merge('PIP_NO_SETUPTOOLS' => '1', 'PIP_NO_WHEEL' => '1'))
126
+ # Gross is_a? hacks but because python_runtime is a container, it
127
+ # gets the full DSL and this has user and group methods from that.
128
+ user = new_resource.parent.is_a?(PoisePython::Resources::PythonVirtualenv::Resource) ? new_resource.parent.user : nil
129
+ group = new_resource.parent.is_a?(PoisePython::Resources::PythonVirtualenv::Resource) ? new_resource.parent.group : nil
130
+ FileUtils.chown(user, group, temp.path) if user || group
131
+ poise_shell_out!(boostrap_cmd, environment: new_resource.parent.python_environment.merge('PIP_NO_SETUPTOOLS' => '1', 'PIP_NO_WHEEL' => '1'), group: group, user: user)
126
132
  ensure
127
133
  temp.close unless temp.closed?
128
134
  temp.unlink
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -170,11 +170,11 @@ EOH
170
170
  python new_resource.name
171
171
  user test_user
172
172
  end
173
- python_package 'attrs' do
173
+ python_package 'docopt' do
174
174
  user test_user
175
175
  virtualenv test_venv
176
176
  end
177
- test_import('attrs', 'attr', python: nil, virtualenv: test_venv, user: test_user)
177
+ test_import('docopt', python: nil, virtualenv: test_venv, user: test_user)
178
178
  end
179
179
  end
180
180
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -125,7 +125,8 @@ module PoisePython
125
125
  end
126
126
  else
127
127
  converge_by("Creating venv at #{new_resource.path}") do
128
- create_virtualenv(%w{venv --without-pip})
128
+ use_withoutpip = cmd.stdout.include?('--without-pip')
129
+ create_virtualenv(use_withoutpip ? %w{venv --without-pip} : %w{venv})
129
130
  end
130
131
  end
131
132
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2015-2016, Noah Kantrowitz
2
+ # Copyright 2015-2017, Noah Kantrowitz
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -16,5 +16,5 @@
16
16
 
17
17
 
18
18
  module PoisePython
19
- VERSION = '1.5.1'
19
+ VERSION = '1.6.0'
20
20
  end