Add or change license headers for all files in a directory
Project description
.. image:: https://img.shields.io/pypi/v/licenseheaders.svg
:target: https://pypi.python.org/pypi/licenseheaders/
:alt: PyPi version
.. image:: https://img.shields.io/pypi/pyversions/licenseheaders.svg
:target: https://pypi.python.org/pypi/licenseheaders/
:alt: Python compatibility
.. image:: https://img.shields.io/travis/elmotec/licenseheaders.svg
:target: https://travis-ci.org/elmotec/licenseheaders
:alt: Build Status
.. image:: https://img.shields.io/pypi/dm/licenseheaders.svg
:alt: PyPi
:target: https://pypi.python.org/pypi/licenseheaders
.. image:: https://coveralls.io/repos/elmotec/licenseheaders/badge.svg
:target: https://coveralls.io/r/elmotec/licenseheaders
:alt: Coverage
.. image:: https://img.shields.io/codacy/474b0af6853a4c5f8f9214d3220571f9.svg
:target: https://www.codacy.com/app/elmotec/licenseheaders/dashboard
:alt: Codacy
========
licenseheaders
========
A tool to update, change or add license headers to all files of any of
the supported types in or below some directory.
Currently, the following file types are supported: Java/Scala/Groovy, bash/sh/csh, ...
Usage
-----
::
usage: licenseheaders.py [-h] [-v] [-V] [-d directory] [-t template] [-y years] [-b] [-a]
[-c copyrightOwner]
License Header Updater
positional arguments: none
optional arguments:
-h, --help Show this help message and exit
-V, --version Show program's version number and exit
-v, --verbose Increases log verbosity (can be specified multiple times)
-d, --dir DIR Directory to process, all subdirectories will be included
-t, --tmpl TMPL Template name or file to use (if not specified, -y must be specified)
-y, --years YEARS If template is specified, the year to substitute, otherwise this year
or year range will replace any existing year in existing headers.
Replaces variable ${years} in a template
-b, --backup For each file that gets changed, create a backup of the original with
the additional filename extension .bak
-c, --cr CO Set copyright owner to CO, replaces variable ${owner} in a template
-a, --addonly add a header to all supported file types, ignore any existing headers.
--enc ENC Use file encoding ENC instead of UTF-8 for the program files.
Examples:
# Add a new license header or replace any existing one based on the lgpl3 template.
# Process all files of supported type in or below the current directory.
# Use "Eager Hacker" as the copyright owner.
licenseheaders.py -t lgpl3 -c "Eager Hacker"
If licenseheaders is installed as a package (from pypi for instance), one can interact with it as a command line tool:
::
python -m licenseheaders -t lgpl3 -c "Eager Hacker"
or directly:
::
licenseheaders -t lgpl3 -c "Eager Hacker"
Installation
------------
Download ``licenseheaders.py`` from ``http://github.com/johann-petrak/licenseheaders`` or :
::
pip install licenseheaders
Template names and files
------------------------
This library comes with a number of predefined templates. If a template name is specified
which when matched against all predefined template names matches exactly one as a substring,
then that template is used. Otherwise the name is expected to be the path of file.
If a template does not contain any variables of the form `${varname}` it is used as is.
Otherwise the program will try to replace the variable from one of the following
sources:
- an environment variable with the same name but the prefix `LICENSE_HEADERS_` added
- the command line option that can be used to set the variable (see usage)
Supported file types and how they are processed
-----------------------------------------------
Java:
- assumed for all files with the extensions: .java, .scala, .groovy
- only headers that use Java block comments are recognised as existing headers
- the template text will be wrapped in block comments
License
-------
Licensed under the term of `MIT License`_. See attached file LICENSE.txt.
.. _MIT License: http://en.wikipedia.org/wiki/MIT_License
:target: https://pypi.python.org/pypi/licenseheaders/
:alt: PyPi version
.. image:: https://img.shields.io/pypi/pyversions/licenseheaders.svg
:target: https://pypi.python.org/pypi/licenseheaders/
:alt: Python compatibility
.. image:: https://img.shields.io/travis/elmotec/licenseheaders.svg
:target: https://travis-ci.org/elmotec/licenseheaders
:alt: Build Status
.. image:: https://img.shields.io/pypi/dm/licenseheaders.svg
:alt: PyPi
:target: https://pypi.python.org/pypi/licenseheaders
.. image:: https://coveralls.io/repos/elmotec/licenseheaders/badge.svg
:target: https://coveralls.io/r/elmotec/licenseheaders
:alt: Coverage
.. image:: https://img.shields.io/codacy/474b0af6853a4c5f8f9214d3220571f9.svg
:target: https://www.codacy.com/app/elmotec/licenseheaders/dashboard
:alt: Codacy
========
licenseheaders
========
A tool to update, change or add license headers to all files of any of
the supported types in or below some directory.
Currently, the following file types are supported: Java/Scala/Groovy, bash/sh/csh, ...
Usage
-----
::
usage: licenseheaders.py [-h] [-v] [-V] [-d directory] [-t template] [-y years] [-b] [-a]
[-c copyrightOwner]
License Header Updater
positional arguments: none
optional arguments:
-h, --help Show this help message and exit
-V, --version Show program's version number and exit
-v, --verbose Increases log verbosity (can be specified multiple times)
-d, --dir DIR Directory to process, all subdirectories will be included
-t, --tmpl TMPL Template name or file to use (if not specified, -y must be specified)
-y, --years YEARS If template is specified, the year to substitute, otherwise this year
or year range will replace any existing year in existing headers.
Replaces variable ${years} in a template
-b, --backup For each file that gets changed, create a backup of the original with
the additional filename extension .bak
-c, --cr CO Set copyright owner to CO, replaces variable ${owner} in a template
-a, --addonly add a header to all supported file types, ignore any existing headers.
--enc ENC Use file encoding ENC instead of UTF-8 for the program files.
Examples:
# Add a new license header or replace any existing one based on the lgpl3 template.
# Process all files of supported type in or below the current directory.
# Use "Eager Hacker" as the copyright owner.
licenseheaders.py -t lgpl3 -c "Eager Hacker"
If licenseheaders is installed as a package (from pypi for instance), one can interact with it as a command line tool:
::
python -m licenseheaders -t lgpl3 -c "Eager Hacker"
or directly:
::
licenseheaders -t lgpl3 -c "Eager Hacker"
Installation
------------
Download ``licenseheaders.py`` from ``http://github.com/johann-petrak/licenseheaders`` or :
::
pip install licenseheaders
Template names and files
------------------------
This library comes with a number of predefined templates. If a template name is specified
which when matched against all predefined template names matches exactly one as a substring,
then that template is used. Otherwise the name is expected to be the path of file.
If a template does not contain any variables of the form `${varname}` it is used as is.
Otherwise the program will try to replace the variable from one of the following
sources:
- an environment variable with the same name but the prefix `LICENSE_HEADERS_` added
- the command line option that can be used to set the variable (see usage)
Supported file types and how they are processed
-----------------------------------------------
Java:
- assumed for all files with the extensions: .java, .scala, .groovy
- only headers that use Java block comments are recognised as existing headers
- the template text will be wrapped in block comments
License
-------
Licensed under the term of `MIT License`_. See attached file LICENSE.txt.
.. _MIT License: http://en.wikipedia.org/wiki/MIT_License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
licenseheaders-0.4.tar.gz
(9.7 kB
view details)
Built Distributions
licenseheaders-0.4-py3.6.egg
(27.0 kB
view details)
File details
Details for the file licenseheaders-0.4.tar.gz
.
File metadata
- Download URL: licenseheaders-0.4.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cc8868012ad69e3e078aaf4241717156e71658b649bc823fb68caa0ce130bef |
|
MD5 | a25c6e02d0fb4a7abdafe9394af3eb79 |
|
BLAKE2b-256 | 2e78c222c30451066b8e1419619c4ab25ca56e4e3da9900bdd49335427df337f |
File details
Details for the file licenseheaders-0.4-py3.6.egg
.
File metadata
- Download URL: licenseheaders-0.4-py3.6.egg
- Upload date:
- Size: 27.0 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d48bd2fa20cece7d20667d5dd3d2e75870f6e849e377ce989e62e565d85e5b69 |
|
MD5 | dc1941f3b196b897eaf5950a0e23ac17 |
|
BLAKE2b-256 | 4d18df817207c12a8e17d7daa3f6acd9482a5b5b1ff48ae82b2da616c7fc3e61 |
File details
Details for the file licenseheaders-0.4-py3-none-any.whl
.
File metadata
- Download URL: licenseheaders-0.4-py3-none-any.whl
- Upload date:
- Size: 22.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13332118a528e165c40e9261a2d251a66cdb22c3bed94baf01a73f6a47c6b95f |
|
MD5 | f40c8306a25c3cc8a94ae59d4ca2cab4 |
|
BLAKE2b-256 | 445348af72c20a071192f9e00adf4a1f2426e29c24f96ac9a8024d6704fb0b69 |