File tree Expand file tree Collapse file tree 2 files changed +34
-4
lines changed Expand file tree Collapse file tree 2 files changed +34
-4
lines changed Original file line number Diff line number Diff line change 17
17
import sys
18
18
19
19
import nox
20
+ import os
21
+ import shutil
20
22
21
23
test_dependencies = [
22
24
"django>=2.0.0" ,
@@ -59,9 +61,22 @@ def lint(session):
59
61
],
60
62
)
61
63
def unit (session , oauth2client ):
64
+ # Clean up dist and build folders
65
+ shutil .rmtree ('dist' , ignore_errors = True )
66
+ shutil .rmtree ('build' , ignore_errors = True )
67
+
62
68
session .install (* test_dependencies )
63
69
session .install (oauth2client )
64
- session .install ('.' )
70
+
71
+ # Create and install wheels
72
+ session .run ('python3' , 'setup.py' , 'bdist_wheel' )
73
+ session .install (os .path .join ('dist' , os .listdir ('dist' ).pop ()))
74
+
75
+ # Run tests from a different directory to test the package artifacts
76
+ root_dir = os .path .dirname (os .path .realpath (__file__ ))
77
+ temp_dir = session .create_tmp ()
78
+ session .chdir (temp_dir )
79
+ shutil .copytree (os .path .join (root_dir , 'tests' ), 'tests' )
65
80
66
81
# Run py.test against the unit tests.
67
82
session .run (
Original file line number Diff line number Diff line change 27
27
28
28
import io
29
29
import os
30
- from setuptools import setup
30
+ import setuptools
31
+
32
+ # Disable version normalization performed by setuptools.setup()
33
+ try :
34
+ # Try the approach of using sic(), added in setuptools 46.1.0
35
+ from setuptools import sic
36
+ except ImportError :
37
+ # Try the approach of replacing packaging.version.Version
38
+ sic = lambda v : v
39
+ try :
40
+ # setuptools >=39.0.0 uses packaging from setuptools.extern
41
+ from setuptools .extern import packaging
42
+ except ImportError :
43
+ # setuptools <39.0.0 uses packaging from pkg_resources.extern
44
+ from pkg_resources .extern import packaging
45
+ packaging .version .Version = packaging .version .LegacyVersion
31
46
32
47
packages = ["apiclient" , "googleapiclient" , "googleapiclient/discovery_cache" ]
33
48
48
63
49
64
version = "2.2.0"
50
65
51
- setup (
66
+ setuptools . setup (
52
67
name = "google-api-python-client" ,
53
- version = version ,
68
+ version = sic ( version ) ,
54
69
description = "Google API Client Library for Python" ,
55
70
long_description = readme ,
56
71
long_description_content_type = 'text/markdown' ,
You can’t perform that action at this time.
0 commit comments