Skip to content

Commit d3eed9a

Browse files
authored
Merge pull request #42 from nexB/use-paths-in-codebase
Use paths in codebase
2 parents c2987ff + 7c2d362 commit d3eed9a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4553
-1933
lines changed

.github/workflows/pypi-release.yml

Lines changed: 76 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,83 @@
1-
name: Release library as a PyPI wheel and sdist on GH release creation
1+
name: Create library release archives, create a GH release and publish PyPI wheel and sdist on tag in main branch
2+
3+
4+
# This is executed automatically on a tag in the main branch
5+
6+
# Summary of the steps:
7+
# - build wheels and sdist
8+
# - upload wheels and sdist to PyPI
9+
# - create gh-release and upload wheels and dists there
10+
# TODO: smoke test wheels and sdist
11+
# TODO: add changelog to release text body
12+
13+
# WARNING: this is designed only for packages building as pure Python wheels
214

315
on:
4-
release:
5-
types: [created]
16+
workflow_dispatch:
17+
push:
18+
tags:
19+
- "v*.*.*"
620

721
jobs:
8-
build-and-publish-to-pypi:
22+
build-pypi-distribs:
923
name: Build and publish library to PyPI
1024
runs-on: ubuntu-20.04
25+
26+
steps:
27+
- uses: actions/checkout@master
28+
- name: Set up Python
29+
uses: actions/setup-python@v1
30+
with:
31+
python-version: 3.9
32+
33+
- name: Install pypa/build
34+
run: python -m pip install build --user
35+
36+
- name: Build a binary wheel and a source tarball
37+
run: python -m build --sdist --wheel --outdir dist/
38+
39+
- name: Upload built archives
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: pypi_archives
43+
path: dist/*
44+
45+
46+
create-gh-release:
47+
name: Create GH release
48+
needs:
49+
- build-pypi-distribs
50+
runs-on: ubuntu-20.04
51+
52+
steps:
53+
- name: Download built archives
54+
uses: actions/download-artifact@v3
55+
with:
56+
name: pypi_archives
57+
path: dist
58+
59+
- name: Create GH release
60+
uses: softprops/action-gh-release@v1
61+
with:
62+
draft: true
63+
files: dist/*
64+
65+
66+
create-pypi-release:
67+
name: Create PyPI release
68+
needs:
69+
- create-gh-release
70+
runs-on: ubuntu-20.04
71+
1172
steps:
12-
- uses: actions/checkout@master
13-
- name: Set up Python
14-
uses: actions/setup-python@v1
15-
with:
16-
python-version: 3.9
17-
- name: Install pypa/build
18-
run: python -m pip install build --user
19-
- name: Build a binary wheel and a source tarball
20-
run: python -m build --sdist --wheel --outdir dist/
21-
.
22-
- name: Publish distribution to PyPI
23-
if: startsWith(github.ref, 'refs/tags')
24-
uses: pypa/gh-action-pypi-publish@master
25-
with:
26-
password: ${{ secrets.PYPI_API_TOKEN }}
27-
73+
- name: Download built archives
74+
uses: actions/download-artifact@v3
75+
with:
76+
name: pypi_archives
77+
path: dist
78+
79+
- name: Publish to PyPI
80+
if: startsWith(github.ref, 'refs/tags')
81+
uses: pypa/gh-action-pypi-publish@master
82+
with:
83+
password: ${{ secrets.PYPI_API_TOKEN }}

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

CHANGELOG.rst

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,85 @@ Release notes
44
Version (next)
55
------------------------------
66

7+
TBD.
8+
9+
Version 31.0.0 - (2022-05-16)
10+
------------------------------
11+
12+
This is a major version with API-breaking changes in the resource module.
13+
14+
- The Resource has no rid (resource id) and no pid (parent id). Instead
15+
we now use internally a simpler mapping of {path: Resource} object.
16+
As a result the iteration on a Codebase is faster but this requires more
17+
memory.
18+
19+
- The Codebase and VirtualCodebase accepts a new "paths" argument that is list
20+
of paths. When provided, the Codebase will only contain Resources with these
21+
paths and no other resources. This handy to create a Codebase with only a
22+
subset of paths of interest. When we create a Codebase or VirtualCodebase
23+
with paths, we also always create any intermediate directories. So if you
24+
ask for a path of "root/dir/file", we create three resources: "root",
25+
"root/dir" and "root/dir/file". We accumulate codebase errors if the paths
26+
does not exists in the Codebase or VirtualCodebase. The paths must start with
27+
the root path segment and must be POSIX paths.
28+
29+
- When you create a VirtualCodebase with multiple scans, we now prefix each
30+
scan path with a codebase-1/, codebase-2/, etc. directory in addition to the
31+
"virtual_root" shared root directory. Otherwise files data was overwritten
32+
and inconsistent when each location "files" were sharing leading path
33+
segments. So if you provide to JSON inputs with that each contain the path
34+
"root/dir/file", the VirtualCodebase will contain these paths:
35+
36+
- "virtual_root/codebase-1/root/dir/file"
37+
- "virtual_root/codebase-2/root/dir/file"
38+
39+
It is otherwise practically impossible to correctly merge file data from
40+
multiple codebases reliably, so adding this prefix ensures that we are doing
41+
the right thing
42+
43+
- The Resource.path now never contains leading or trailing slash. We also
44+
normalize the path everywhere. In particular this behaviour is visible when
45+
you create a Codebase with a "full_root" argument. Previously, the paths of a
46+
"full_root" Codebase were prefixed with a slash "/".
47+
48+
- When you create a VirtualCodebase with more than one Resource, we now recreate
49+
the directory tree for any intermediary directory used in a path that is
50+
otherwise missing from files path list.
51+
In particular this behaviour changed when you create a VirtualCodebase from
52+
a previous Codebase created with a "full_root" argument. Previously, the
53+
missing paths of a "full_root" Codebase were kept unchanged.
54+
Note that the VirtualCodebase has always ignored the "full_root" argument.
55+
56+
- The Codebase and VirtualCodebase are now iterable. Iterating on a codebase
57+
is the same as a top-down walk.
58+
59+
- The "Codebase.original_location" attributed has been removed.
60+
No known users of commoncode used this.
61+
62+
- The Codebase and VirtualCodebase no longer have a "full_root" and
63+
"strip_root" constructor arguments and attributes. These can still be
64+
passed but they will be ignored.
65+
66+
- Resource.path is now always the plain path where the first segment
67+
is the last segment of the root location, e.g. the root fiename.
68+
69+
- The Resource now has new "full_root_path" and "strip_root_path"
70+
properties that return the corresponding paths.
71+
72+
- The Resource.to_dict and the new Codebase.to_list both have a new
73+
"full_root" and "strip_root" arguments
74+
75+
- The Resource.get_path() method accepts "full_root" and "strip_root" arguments.
76+
77+
- The Resource.create_child() method has been removed.
78+
79+
Other changes:
80+
781
- Remove Python upper version limit.
82+
- Merge latest skeleton
83+
- fileutils.parent_directory() now accepts a "with_trail" argument.
84+
The returned directory has a trailing path separator unless with_trail is False.
85+
The default is True and the default behaviour is unchanged.
886

987

1088
Version 30.2.0 - (2022-05-02)
@@ -39,7 +117,7 @@ Version 30.1.0 (2022-04-05)
39117
Version 30.0.0 (2021-09-24)
40118
------------------------------
41119

42-
- Switch back from clamver to semver.
120+
- Switch back from calver to semver.
43121
- Adopt latest skeleton. The default virtualenv directory is now venv and no
44122
longer tmp
45123
- Fix issue with Click progressbar API #23 that prohibited to use all supported

CODE_OF_CONDUCT.rst

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
Contributor Covenant Code of Conduct
2+
====================================
3+
4+
Our Pledge
5+
----------
6+
7+
In the interest of fostering an open and welcoming environment, we as
8+
contributors and maintainers pledge to making participation in our
9+
project and our community a harassment-free experience for everyone,
10+
regardless of age, body size, disability, ethnicity, gender identity and
11+
expression, level of experience, education, socio-economic status,
12+
nationality, personal appearance, race, religion, or sexual identity and
13+
orientation.
14+
15+
Our Standards
16+
-------------
17+
18+
Examples of behavior that contributes to creating a positive environment
19+
include:
20+
21+
- Using welcoming and inclusive language
22+
- Being respectful of differing viewpoints and experiences
23+
- Gracefully accepting constructive criticism
24+
- Focusing on what is best for the community
25+
- Showing empathy towards other community members
26+
27+
Examples of unacceptable behavior by participants include:
28+
29+
- The use of sexualized language or imagery and unwelcome sexual
30+
attention or advances
31+
- Trolling, insulting/derogatory comments, and personal or political
32+
attacks
33+
- Public or private harassment
34+
- Publishing others’ private information, such as a physical or
35+
electronic address, without explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
Our Responsibilities
40+
--------------------
41+
42+
Project maintainers are responsible for clarifying the standards of
43+
acceptable behavior and are expected to take appropriate and fair
44+
corrective action in response to any instances of unacceptable behavior.
45+
46+
Project maintainers have the right and responsibility to remove, edit,
47+
or reject comments, commits, code, wiki edits, issues, and other
48+
contributions that are not aligned to this Code of Conduct, or to ban
49+
temporarily or permanently any contributor for other behaviors that they
50+
deem inappropriate, threatening, offensive, or harmful.
51+
52+
Scope
53+
-----
54+
55+
This Code of Conduct applies both within project spaces and in public
56+
spaces when an individual is representing the project or its community.
57+
Examples of representing a project or community include using an
58+
official project e-mail address, posting via an official social media
59+
account, or acting as an appointed representative at an online or
60+
offline event. Representation of a project may be further defined and
61+
clarified by project maintainers.
62+
63+
Enforcement
64+
-----------
65+
66+
Instances of abusive, harassing, or otherwise unacceptable behavior may
67+
be reported by contacting the project team at [email protected]
68+
or on the Gitter chat channel at https://gitter.im/aboutcode-org/discuss .
69+
All complaints will be reviewed and investigated and will result in a
70+
response that is deemed necessary and appropriate to the circumstances.
71+
The project team is obligated to maintain confidentiality with regard to
72+
the reporter of an incident. Further details of specific enforcement
73+
policies may be posted separately.
74+
75+
Project maintainers who do not follow or enforce the Code of Conduct in
76+
good faith may face temporary or permanent repercussions as determined
77+
by other members of the project’s leadership.
78+
79+
Attribution
80+
-----------
81+
82+
This Code of Conduct is adapted from the `Contributor Covenant`_ ,
83+
version 1.4, available at
84+
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
85+
86+
.. _Contributor Covenant: https://www.contributor-covenant.org

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include *.rst
99
include setup.*
1010
include configure*
1111
include requirements*
12-
include .git*
12+
include .giti*
1313

1414
global-exclude *.py[co] __pycache__ *.*~
1515

configure

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ CFG_BIN_DIR=$CFG_ROOT_DIR/$VIRTUALENV_DIR/bin
5454

5555
################################
5656
# Thirdparty package locations and index handling
57-
# Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
57+
# Find packages from the local thirdparty directory
5858
if [ -d "$CFG_ROOT_DIR/thirdparty" ]; then
5959
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty"
6060
fi
61-
PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS --find-links https://thirdparty.aboutcode.org/pypi/simple/links.html"
6261

6362

6463
################################

configure.bat

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,10 @@ set "CFG_BIN_DIR=%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"
5252

5353
@rem ################################
5454
@rem # Thirdparty package locations and index handling
55-
@rem # Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
55+
@rem # Find packages from the local thirdparty directory
5656
if exist "%CFG_ROOT_DIR%\thirdparty" (
5757
set PIP_EXTRA_ARGS=--find-links "%CFG_ROOT_DIR%\thirdparty"
5858
)
59-
set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% --find-links https://thirdparty.aboutcode.org/pypi/simple/links.html"
6059

6160

6261
@rem ################################
@@ -69,7 +68,6 @@ if not defined CFG_QUIET (
6968
@rem ################################
7069
@rem # Main command line entry point
7170
set "CFG_REQUIREMENTS=%REQUIREMENTS%"
72-
set "NO_INDEX=--no-index"
7371

7472
:again
7573
if not "%1" == "" (

docs/source/conf.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
2929
# ones.
3030
extensions = [
31-
'sphinx.ext.intersphinx',
31+
"sphinx.ext.intersphinx",
3232
]
3333

3434
# This points to aboutcode.readthedocs.io
3535
# In case of "undefined label" ERRORS check docs on intersphinx to troubleshoot
3636
# Link was created at commit - https://github.com/nexB/aboutcode/commit/faea9fcf3248f8f198844fe34d43833224ac4a83
3737

3838
intersphinx_mapping = {
39-
'aboutcode': ('https://aboutcode.readthedocs.io/en/latest/', None),
40-
'scancode-workbench': ('https://scancode-workbench.readthedocs.io/en/develop/', None),
39+
"aboutcode": ("https://aboutcode.readthedocs.io/en/latest/", None),
40+
"scancode-workbench": ("https://scancode-workbench.readthedocs.io/en/develop/", None),
4141
}
4242

4343

@@ -62,7 +62,7 @@
6262
# so a file named "default.css" will overwrite the builtin "default.css".
6363
html_static_path = ["_static"]
6464

65-
master_doc = 'index'
65+
master_doc = "index"
6666

6767
html_context = {
6868
"display_github": True,
@@ -72,9 +72,7 @@
7272
"conf_py_path": "/docs/source/", # path in the checkout to the docs root
7373
}
7474

75-
html_css_files = [
76-
'_static/theme_overrides.css'
77-
]
75+
html_css_files = ["_static/theme_overrides.css"]
7876

7977

8078
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.

0 commit comments

Comments
 (0)