Skip to content

Commit

Permalink
update license template and instructions, and whats_new
Browse files Browse the repository at this point in the history
  • Loading branch information
Ariana Barzinpour committed May 8, 2023
1 parent 84691de commit 08c6d70
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
3 changes: 0 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ repos:
- id: forbid-tabs
- id: remove-tabs
args: [--whitespaces-count, '2']
- id: chmod
args: ['644']
files: \.md$
- id: insert-license
files: ./(.*).py$
args:
Expand Down
30 changes: 12 additions & 18 deletions license-headers.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
# Applying or updating license headers

To add or update license headers in this or other Open Data Cube
projects, you can do the following:
To add or update license headers in this or other Open Data Cube projects, you can do the following:

Download the tool from [https://github.com/johann-petrak/licenseheaders](https://github.com/johann-petrak/licenseheaders) and make it executable.
Ensure you have pre-commit hooks installed

```bash
wget https://raw.githubusercontent.com/johann-petrak/licenseheaders/master/licenseheaders.py
chmod +x licenseheaders.py
pre-commit install
```

Change the sections on `python` files, to remove the `headerStartLine` and
`headerEndLine`, like:
Run the `insert-license` hook:

```python
"headerStartLine": "",
"headerEndLine": "",
```bash
pre-commit run insert-license --all-files
```

Run the tool:
To remove the license headers, add the `--remove-header` arg to `.pre-commit-config.yaml` before running the hook.

```bash
python3 ./licenseheaders.py --tmpl license-template.txt --years 2015-2020 --ext py --dir datacube
python3 ./licenseheaders.py --tmpl license-template.txt --years 2015-2020 --ext py --dir integration_tests
python3 ./licenseheaders.py --tmpl license-template.txt --years 2015-2020 --ext py --dir tests
python3 ./licenseheaders.py --tmpl license-template.txt --years 2015-2020 --ext py --dir docs
python3 ./licenseheaders.py --tmpl license-template.txt --years 2015-2020 --ext py --dir examples
```
To make updates to the license text, first remove the headers, then update `license-template.txt` before rerunning the hook as usual to add them back.

Note that the date range is automatically updated to include the current year.

See the full documentation here: [https://github.com/Lucas-C/pre-commit-hooks#insert-license](https://github.com/Lucas-C/pre-commit-hooks#insert-license)
2 changes: 1 addition & 1 deletion license-template.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This file is part of the Open Data Cube, see https://opendatacube.org for more information

Copyright (c) ${years} ODC Contributors
Copyright (c) 2015-2023 ODC Contributors
SPDX-License-Identifier: Apache-2.0

0 comments on commit 08c6d70

Please sign in to comment.