Skip to content

Commit

Permalink
fix(api-versions): ignore beta/alpha,assure latest
Browse files Browse the repository at this point in the history
There were a few bugs in the generator program, which caused old
versions to be picked up, and alphas/betas
  • Loading branch information
Byron committed Mar 10, 2015
1 parent 9377220 commit ff5cbb3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 32 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ regen-apis: clean-apis apis license
clean: clean-apis
-rm -Rf $(VENV_DIR)
-rm $(API_DEPS)
-rm $(API_LIST)

update-json:
etc/bin/update-json.sh $(GOOGLE_GO_APIS_REPO) etc/api
Expand Down
48 changes: 24 additions & 24 deletions etc/api/api-list.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# DO NOT EDIT !!!
# File created from 'etc/bin/api_version_to_yaml.py etc/api etc/api/api-list.yaml etc/api/api-list.yaml'
# Created by 'etc/bin/api_version_to_yaml.py etc/api etc/api/api-list.yaml etc/api/api-list.yaml'
# DO NOT EDIT !!!
api:
list:
adexchangebuyer:
- v1.2
- v1.3
adexchangeseller:
- v1
- v2.0
admin:
- directory_v1
- reports_v1
adsense:
- v1.2
- v1.4
adsensehost:
- v4.1
analytics:
- v2.4
- v3
androidpublisher:
- v1
- v2
appsactivity:
- v1
appstate:
Expand All @@ -28,13 +28,13 @@ api:
bigquery:
- v2
blogger:
- v2
- v3
books:
- v1
calendar:
- v3
civicinfo:
- us_v1
- v2
cloudlatencytest:
- v2
cloudmonitoring:
Expand All @@ -52,11 +52,11 @@ api:
dataflow:
- v1b4
datastore:
- v1beta1
- v1beta2
deploymentmanager:
- v2beta1
dfareporting:
- v1
- v2.0
discovery:
- v1
dns:
Expand All @@ -66,11 +66,11 @@ api:
doubleclicksearch:
- v2
drive:
- v1
- v2
fitness:
- v1
freebase:
- v1
- v1sandbox
games:
- v1
gamesconfiguration:
Expand All @@ -80,7 +80,7 @@ api:
gan:
- v1beta1
genomics:
- v1beta
- v1beta2
gmail:
- v1
groupsmigration:
Expand All @@ -94,43 +94,43 @@ api:
manager:
- v1beta2
mapsengine:
- exp2
- v1
mirror:
- v1
oauth2:
- v1
- v2
pagespeedonline:
- v1
- v2
plus:
- v1
plusdomains:
- v1
prediction:
- v1.2
- v1.6
pubsub:
- v1beta1
- v1beta2
qpxexpress:
- v1
replicapool:
- v1beta1
- v1beta2
replicapoolupdater:
- v1beta1
reseller:
- v1
- v1sandbox
resourceviews:
- v1beta1
- v1beta2
siteverification:
- v1
spectrum:
- v1explorer
sqladmin:
- v1beta1
- v1beta4
storage:
- v1
tagmanager:
- v1
taskqueue:
- v1beta1
- v1beta2
tasks:
- v1
translate:
Expand Down
25 changes: 18 additions & 7 deletions etc/bin/api_version_to_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,32 @@
raise ValueError("Directory '%s' not accessible" % api_base)

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

api_data = yaml.load(open(yaml_path, 'r'))['api']['list']
for api_name in sorted(os.listdir(api_base)):
api_path = join(api_base, api_name)
if not isdir(api_path):
continue
last_version = list(sorted(v for v in os.listdir(api_path) if isdir(join(api_path, v))))
if not last_version:
all_versions = sorted((v for v in os.listdir(api_path) if isdir(join(api_path, v))), reverse=True)
if not all_versions:
continue

versions = api_data.get('api_name', list())
last_version = None
for v in all_versions:
if 'beta' not in v and 'alpha' not in v:
last_version = v
break
# end for each version
if last_version is None:
last_version = all_versions[0]

versions = api_data.get(api_name, list())
if last_version not in versions:
versions.append(last_version[0])
versions.append(last_version)
api_data[api_name] = list(sorted(versions))
# end for each item in api-base

Expand Down

0 comments on commit ff5cbb3

Please sign in to comment.