feat(license): improved license information

... and readme, and looks of author listing.
Slowly getting into the flow, possibilities seem thrilling.
This commit is contained in:
Sebastian Thiel
2015-03-02 15:23:41 +01:00
parent 3670e4f6c9
commit fc15a7030f
8 changed files with 31 additions and 5 deletions

View File

@@ -46,7 +46,7 @@ LICENSE.md: $(MAKO_SRC)/LICENSE.md.mako $(API_SHARED_INFO)
license: LICENSE.md
rebuild-apis: clean-apis apis
rebuild-apis: clean-apis apis license
clean: clean-apis
-rm -Rf $(VENV_DIR)

View File

@@ -31,6 +31,7 @@ cargo:
repository_url: https://github.com/Byron/google-apis-rs
copyright:
license_abbrev: "MIT"
# should at some point be 2015-2016 ...
years: '2015'
authors:

View File

@@ -1,8 +1,9 @@
## -*- coding: utf-8 -*-
<%! import util %>\
The MIT License (MIT)
=====================
Copyright © `${copyright.years}` ${', '.join("`%s`" % a for a in copyright.authors)}
Copyright © `${copyright.years}` ${util.put_and(["`%s`" % a for a in copyright.authors])}
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation

View File

@@ -2,4 +2,5 @@
<%namespace name="lib" file="lib/lib.mako"/>\
The `${util.library_name(name, version)}` library allows access to all features of *${canonicalName}*.
<%lib:docs />
<%lib:docs />
<%lib:license />

View File

@@ -1,4 +1,5 @@
<%! import util %>\
<%namespace name="mutil" file="lib/util.mako"/>\
# DO NOT EDIT !
# This file was generated automatically by '${self.uri}'
# DO NOT EDIT !
@@ -8,10 +9,10 @@ name = "${name}${util.to_api_version(version)}"
version = "${cargo.build_version}"
authors = [${",\n ".join('"%s"' % a for a in cargo.authors)}]
description = "A complete library to interact with ${canonicalName} (protocol ${version})"
repository = "${cargo.repo_base_url}/${OUTPUT_DIR}"
repository = "${mutil.repository_url()}"
homepage = "${documentationLink}"
documentation = "${cargo.doc_base_url}"
license = "MIT"
license = "${copyright.license_abbrev}"
keywords = ["${name}", ${", ".join('"%s"' % k for k in cargo.keywords)}]
[dependencies]

View File

@@ -1,3 +1,13 @@
<%! import util %>\
<%def name="docs()">\
TODO: Library level fully fledged documentation, incuding **summary** and **usage**.
</%def>
<%def name="license()">\
# License
The **${util.library_name(name, version)}** library was generated by ${util.put_and(copyright.authors)}, and is placed
under the *${copyright.license_abbrev}* license.
You can read the full text at the repository's [license file][repo-license].
[repo-license]: ${cargo.repo_base_url + 'LICENSE.md'}
</%def>

View File

@@ -6,4 +6,8 @@
<% assert len(v) >= 2 and v[0] == 'v'%>\
## convert it once to int, just to be sure it is an int
${v[1:]}\
</%def>
<%def name="repository_url()">\
${cargo.repo_base_url}/${OUTPUT_DIR}\
</%def>

View File

@@ -12,6 +12,14 @@ def to_api_version(v):
assert len(v) >= 2 and v[0] == 'v'
return v[1:]
# l must be a list, if it is more than one, 'and' will before last item
# l will also be coma-separtated
# Returns string
def put_and(l):
if len(l) < 2:
return l[0]
return ', '.join(l[:-1]) + ' and ' + l[-1]
# build a full library name (non-canonical)
def library_name(name, version):
return name + to_api_version(version)