60 lines
2.4 KiB
Diff
60 lines
2.4 KiB
Diff
|
--- a/pbr/tests/test_packaging.py
|
||
|
+++ b/pbr/tests/test_packaging.py
|
||
|
@@ -41,6 +41,7 @@
|
||
|
import email
|
||
|
import email.errors
|
||
|
import imp
|
||
|
+import logging
|
||
|
import os
|
||
|
import re
|
||
|
import sys
|
||
|
@@ -56,8 +57,11 @@ import testscenarios
|
||
|
import testtools
|
||
|
from testtools import matchers
|
||
|
import virtualenv
|
||
|
-import wheel.install
|
||
|
+try:
|
||
|
+ from wheel.install import WheelFile
|
||
|
+except ImportError:
|
||
|
+ from wheel.wheelfile import WheelFile
|
||
|
|
||
|
from pbr import git
|
||
|
from pbr import packaging
|
||
|
from pbr.tests import base
|
||
|
@@ -372,13 +376,15 @@ class TestPackagingWheels(base.BaseTestC
|
||
|
relative_wheel_filename = os.listdir(dist_dir)[0]
|
||
|
absolute_wheel_filename = os.path.join(
|
||
|
dist_dir, relative_wheel_filename)
|
||
|
- wheel_file = wheel.install.WheelFile(absolute_wheel_filename)
|
||
|
- wheel_name = wheel_file.parsed_filename.group('namever')
|
||
|
- # Create a directory path to unpack the wheel to
|
||
|
- self.extracted_wheel_dir = os.path.join(dist_dir, wheel_name)
|
||
|
- # Extract the wheel contents to the directory we just created
|
||
|
- wheel_file.zipfile.extractall(self.extracted_wheel_dir)
|
||
|
- wheel_file.zipfile.close()
|
||
|
+ with WheelFile(absolute_wheel_filename) as wheel_file:
|
||
|
+ wheel_name = wheel_file.parsed_filename.group('namever')
|
||
|
+ # Create a directory path to unpack the wheel to
|
||
|
+ self.extracted_wheel_dir = os.path.join(dist_dir, wheel_name)
|
||
|
+ # Extract the wheel contents to the directory we just created
|
||
|
+ if hasattr(wheel_file, 'zipfile'):
|
||
|
+ wheel_file.zipfile.extractall(self.extracted_wheel_dir)
|
||
|
+ else:
|
||
|
+ wheel_file.extractall(self.extracted_wheel_dir)
|
||
|
|
||
|
def test_data_directory_has_wsgi_scripts(self):
|
||
|
# Build the path to the scripts directory
|
||
|
@@ -402,8 +409,10 @@ class TestPackagingWheels(base.BaseTestC
|
||
|
static_object_path = os.path.join(
|
||
|
built_package_dir, static_object_filename)
|
||
|
|
||
|
- self.assertTrue(os.path.exists(built_package_dir))
|
||
|
- self.assertTrue(os.path.exists(static_object_path))
|
||
|
+ self.assertTrue(os.path.exists(built_package_dir),
|
||
|
+ 'built_package_dir %s not found!' % built_package_dir)
|
||
|
+ self.assertTrue(os.path.exists(static_object_path),
|
||
|
+ 'static_object_path %s not found!' % static_object_path)
|
||
|
|
||
|
|
||
|
class TestPackagingHelpers(testtools.TestCase):
|