Skip to content

Commit ff5cbb3

Browse files
committed
fix(api-versions): ignore beta/alpha,assure latest
There were a few bugs in the generator program, which caused old versions to be picked up, and alphas/betas
1 parent 9377220 commit ff5cbb3

3 files changed

Lines changed: 42 additions & 32 deletions

File tree

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ regen-apis: clean-apis apis license
6161
clean: clean-apis
6262
-rm -Rf $(VENV_DIR)
6363
-rm $(API_DEPS)
64-
-rm $(API_LIST)
6564

6665
update-json:
6766
etc/bin/update-json.sh $(GOOGLE_GO_APIS_REPO) etc/api

etc/api/api-list.yaml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# DO NOT EDIT !!!
2-
# File created from 'etc/bin/api_version_to_yaml.py etc/api etc/api/api-list.yaml etc/api/api-list.yaml'
2+
# Created by 'etc/bin/api_version_to_yaml.py etc/api etc/api/api-list.yaml etc/api/api-list.yaml'
33
# DO NOT EDIT !!!
44
api:
55
list:
66
adexchangebuyer:
7-
- v1.2
7+
- v1.3
88
adexchangeseller:
9-
- v1
9+
- v2.0
1010
admin:
11-
- directory_v1
11+
- reports_v1
1212
adsense:
13-
- v1.2
13+
- v1.4
1414
adsensehost:
1515
- v4.1
1616
analytics:
17-
- v2.4
17+
- v3
1818
androidpublisher:
19-
- v1
19+
- v2
2020
appsactivity:
2121
- v1
2222
appstate:
@@ -28,13 +28,13 @@ api:
2828
bigquery:
2929
- v2
3030
blogger:
31-
- v2
31+
- v3
3232
books:
3333
- v1
3434
calendar:
3535
- v3
3636
civicinfo:
37-
- us_v1
37+
- v2
3838
cloudlatencytest:
3939
- v2
4040
cloudmonitoring:
@@ -52,11 +52,11 @@ api:
5252
dataflow:
5353
- v1b4
5454
datastore:
55-
- v1beta1
55+
- v1beta2
5656
deploymentmanager:
5757
- v2beta1
5858
dfareporting:
59-
- v1
59+
- v2.0
6060
discovery:
6161
- v1
6262
dns:
@@ -66,11 +66,11 @@ api:
6666
doubleclicksearch:
6767
- v2
6868
drive:
69-
- v1
69+
- v2
7070
fitness:
7171
- v1
7272
freebase:
73-
- v1
73+
- v1sandbox
7474
games:
7575
- v1
7676
gamesconfiguration:
@@ -80,7 +80,7 @@ api:
8080
gan:
8181
- v1beta1
8282
genomics:
83-
- v1beta
83+
- v1beta2
8484
gmail:
8585
- v1
8686
groupsmigration:
@@ -94,43 +94,43 @@ api:
9494
manager:
9595
- v1beta2
9696
mapsengine:
97-
- exp2
97+
- v1
9898
mirror:
9999
- v1
100100
oauth2:
101-
- v1
101+
- v2
102102
pagespeedonline:
103-
- v1
103+
- v2
104104
plus:
105105
- v1
106106
plusdomains:
107107
- v1
108108
prediction:
109-
- v1.2
109+
- v1.6
110110
pubsub:
111-
- v1beta1
111+
- v1beta2
112112
qpxexpress:
113113
- v1
114114
replicapool:
115-
- v1beta1
115+
- v1beta2
116116
replicapoolupdater:
117117
- v1beta1
118118
reseller:
119-
- v1
119+
- v1sandbox
120120
resourceviews:
121-
- v1beta1
121+
- v1beta2
122122
siteverification:
123123
- v1
124124
spectrum:
125125
- v1explorer
126126
sqladmin:
127-
- v1beta1
127+
- v1beta4
128128
storage:
129129
- v1
130130
tagmanager:
131131
- v1
132132
taskqueue:
133-
- v1beta1
133+
- v1beta2
134134
tasks:
135135
- v1
136136
translate:

etc/bin/api_version_to_yaml.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,32 @@
2323
raise ValueError("Directory '%s' not accessible" % api_base)
2424

2525
yaml_path = sys.argv[2]
26-
if not isfile(yaml_path):
27-
raise ValueError("Didn't find yaml data at '%s'" % yaml_path)
26+
if isfile(yaml_path):
27+
api_data = yaml.load(open(yaml_path, 'r'))['api']['list']
28+
else:
29+
api_data = dict()
2830

29-
api_data = yaml.load(open(yaml_path, 'r'))['api']['list']
31+
3032
for api_name in sorted(os.listdir(api_base)):
3133
api_path = join(api_base, api_name)
3234
if not isdir(api_path):
3335
continue
34-
last_version = list(sorted(v for v in os.listdir(api_path) if isdir(join(api_path, v))))
35-
if not last_version:
36+
all_versions = sorted((v for v in os.listdir(api_path) if isdir(join(api_path, v))), reverse=True)
37+
if not all_versions:
3638
continue
3739

38-
versions = api_data.get('api_name', list())
40+
last_version = None
41+
for v in all_versions:
42+
if 'beta' not in v and 'alpha' not in v:
43+
last_version = v
44+
break
45+
# end for each version
46+
if last_version is None:
47+
last_version = all_versions[0]
48+
49+
versions = api_data.get(api_name, list())
3950
if last_version not in versions:
40-
versions.append(last_version[0])
51+
versions.append(last_version)
4152
api_data[api_name] = list(sorted(versions))
4253
# end for each item in api-base
4354

0 commit comments

Comments
 (0)