Skip to content

Commit 4e44dc4

Browse files
committed
Adding a new configure script
Updated docs, tests and some cosmetics code mods. Added 3pp libraries (with their own about file)
1 parent a0915ce commit 4e44dc4

Some content is hidden

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

47 files changed

+4862
-304
lines changed

.gitignore

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
*.py[cod]
22

3-
# C extensions
4-
*.so
5-
6-
# Packages
7-
*.egg
8-
*.egg-info
9-
dist
10-
build
11-
eggs
12-
parts
13-
bin
14-
var
15-
sdist
16-
develop-eggs
17-
.installed.cfg
18-
lib
3+
/build
4+
/bin
5+
/var
6+
/lib
197
lib64
8+
/Include
9+
/Lib
10+
/Scripts
11+
/include
2012

2113
# Installer logs
2214
pip-log.txt
@@ -36,4 +28,4 @@ nosetests.xml
3628
/.settings
3729

3830
# PyCharm project
39-
.idea/
31+
.idea/

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
language: python
2+
23
python:
34
- "2.6"
45
- "2.7"
56
install:
6-
- "pip install -r requirements.txt --use-mirrors"
7-
- "pip install coverage"
8-
- "pip install coveralls"
7+
- ./configure etc/conf/tests
98
script:
109
- "coverage run --source=about_code_tool setup.py test"
1110
after_success:
12-
coveralls
11+
- coveralls

NOTICE

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Copyright (c) 2013-2014 nexB Inc. http://www.nexb.com/ - All rights reserved.
2+
Licensed under the Apache License, Version 2.0 (the "License");
3+
you may not use this file except in compliance with the License.
4+
You may obtain a copy of the License at
5+
http://www.apache.org/licenses/LICENSE-2.0
6+
Unless required by applicable law or agreed to in writing, software
7+
distributed under the License is distributed on an "AS IS" BASIS,
8+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
See the License for the specific language governing permissions and
10+
limitations under the License.

README.rst

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ Open and run the installer using all the default options.
5252

5353
INSTALLATION
5454
------------
55-
Download and save the about.py file from:
56-
https://raw.github.com/dejacode/about-code-tool/master/about.py
55+
Checkout or download and extract the AboutCode tool from:
56+
https://github.com/dejacode/about-code-tool/
57+
58+
To install all the needed dependencies in a virtualenv, run (on posix)::
59+
source configure
60+
or on windows::
61+
configure
5762

5863

5964
TESTS
6065
-----
61-
Optionally, to verify that everything works fine you can run the test suite,
62-
download the whole repository at:
63-
https://github.com/dejacode/about-code-tool/archive/master.zip
64-
65-
Then open a terminal or command prompt, extract the download if needed and run::
66-
66+
To verify that everything works fine you can run the test suite with::
6767
python setup.py test
6868

6969

@@ -147,13 +147,15 @@ information will be saved to the CSV file named "thirdparty_about.csv".
147147
Example syntax:
148148
genabout.py --extract_license --api_url='api_url' --api_username='api_username' --api_key='api_key'
149149

150+
150151
Example::
151152

152153
$ python genabout.py thirdparty_code.csv /tmp/thirdparty_about/
153154

154155
In this example, the tool will look at the "thirdparty_code.csv" and generate
155156
the .ABOUT files in the directory /tmp/thirdparty_about/.
156157

158+
157159
**genattrib.py**
158160

159161
::
@@ -204,17 +206,17 @@ For issues, you can use:
204206

205207
SOURCE CODE
206208
-----------
207-
The ABOUT tool is available through GitHub. For the latest version visit:
208-
209+
AboutCode is available through GitHub. For the latest version visit:
209210
https://github.com/dejacode/about-code-tool
210211

211212

212213
HACKING
213214
-------
214215
We accept pull requests provided under the same license as this tool.
216+
You agree to the http://developercertificate.org/
215217

216218

217219
LICENSE
218220
-------
219-
The ABOUT tool is released under the Apache 2.0 license.
221+
AboutCode is released under the Apache 2.0 license.
220222
See (of course) the about.ABOUT file for details.

about.ABOUT

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,25 @@
1-
about_resource: about-code-tool/about.py
1+
about_resource: .
22

3-
name: ABOUT tool
4-
version: 0.8.1
3+
name: AboutCode
4+
version: 0.9.0
55

66
owner: nexB Inc.
77
author: Jillian Daguil, Chin Yeung Li, Philippe Ombredanne, Thomas Druez
88

9-
109
home_url: http://dejacode.org
11-
readme_file: README.rst
12-
changelog_file: CHANGELOG.txt
1310

1411
vcs_tool: git
1512
vcs_repository: https://github.com/dejacode/about-code-tool.git
1613

17-
description: This is a tool to process ABOUT files. An ABOUT file provides a
18-
simple way to document the provenance (origin and license) 'about' a software
19-
component. An ABOUT file is a small text file stored in the codebase
20-
side-by-side with the software component that it documents.
14+
description: AboutCode is a tool to process ABOUT files. An ABOUT file
15+
provides a simple way to document the provenance (origin and license)
16+
'about' a software component. This is a small text file stored in the
17+
codebase side-by-side with the documented software component.
2118

2219

23-
license_text_file: apache2.LICENSE.txt
20+
dej_license: apache-2.0
21+
license_text_file: apache-2.0.LICENSE
2422
license_spdx: Apache-2.0
25-
copyright: Copyright (c) 2013 nexB, Inc.
26-
27-
notice:
28-
Copyright (c) 2013 nexB, Inc. http://www.nexb.com/ - All rights reserved.
29-
Licensed under the Apache License, Version 2.0 (the "License");
30-
you may not use this file except in compliance with the License.
31-
You may obtain a copy of the License at
32-
http://www.apache.org/licenses/LICENSE-2.0
33-
Unless required by applicable law or agreed to in writing, software
34-
distributed under the License is distributed on an "AS IS" BASIS,
35-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36-
See the License for the specific language governing permissions and
37-
limitations under the License.
23+
copyright: Copyright (c) 2013-2014 nexB Inc.
24+
25+
notice_file: NOTICE

about_code_tool/about.py

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
# -*- coding: utf8 -*-
33

44
"""
5-
This is a tool to process ABOUT files as specified at http://dejacode.org.
5+
AboutCode is a tool to process ABOUT files. ABOUT files are small text files
6+
that document the provenance (aka. the origin and license) of software
7+
components as well as the essential obligation such as attribution/credits and
8+
source code redistribution. See the ABOUT spec at http://dejacode.org.
69
7-
ABOUT files are small text files that document the origin and license of
8-
software components.
9-
10-
This tool read and validates ABOUT files to collect your software components
11-
inventory.
10+
AbouCode reads and validates ABOUT files and collect software components
11+
inventories.
1212
"""
1313

1414
# We require Python 2.6 or later
15-
from __future__ import print_function, with_statement
15+
from __future__ import print_function
1616

1717
from StringIO import StringIO
1818
import codecs
@@ -31,6 +31,7 @@
3131
import string
3232
import sys
3333
import urlparse
34+
import ntpath
3435

3536

3637
__version__ = '0.9.0'
@@ -55,15 +56,13 @@
5556
limitations under the License.
5657
"""
5758

58-
5959
logger = logging.getLogger(__name__)
6060
handler = logging.StreamHandler()
6161
handler.setLevel(logging.CRITICAL)
6262
handler.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
6363
logger.addHandler(handler)
6464

6565

66-
6766
def repr_problem(obj):
6867
"""
6968
Return a formatted representation of a given Warn or Error object
@@ -451,6 +450,24 @@ def repr_problem(obj):
451450
'zlib.LICENSE',
452451
)
453452

453+
def posix_path(path):
454+
"""
455+
Return a path using the posixpath separator given a path that may
456+
contain posix or windows separators, converting \ to /.
457+
"""
458+
return path.replace(ntpath.sep, posixpath.sep)
459+
460+
461+
def native_path(path):
462+
"""
463+
Return a path using the current OS path separator given a path that may
464+
contain posix or windows separators, converting / to \ on windows and \ to
465+
/ on posix OSes.
466+
"""
467+
path = path.replace(ntpath.sep, os.path.sep)
468+
path = path.replace(posixpath.sep, os.path.sep)
469+
return path
470+
454471

455472
def is_about_file(path):
456473
"""
@@ -1057,18 +1074,24 @@ def __iter__(self):
10571074
return iter(self.abouts)
10581075

10591076
@staticmethod
1060-
def _collect_about_files(input_path):
1077+
def _collect_about_files(location):
10611078
"""
1062-
Return a list containing file-paths of valid .ABOUT file given a path.
1063-
When the input is a file rather than a directory. The returned list
1064-
may contain only one item if the file name is valid.
1079+
Given the location of a file or directory, return a list of
1080+
locations of valid .ABOUT files.
10651081
"""
1066-
if os.path.isfile(input_path):
1067-
return filter(is_about_file, [input_path])
1082+
paths = []
1083+
if location:
1084+
if os.path.isfile(location) and is_about_file(location):
1085+
paths = [location]
1086+
else:
1087+
for root, _, files in os.walk(location):
1088+
for name in files:
1089+
if is_about_file(name):
1090+
paths.append(os.path.join(root, name))
1091+
# normalize the paths to use os path seps
1092+
paths = [posix_path(p)for p in paths]
1093+
return paths
10681094

1069-
return [os.path.join(root, name)
1070-
for root, _, files in os.walk(input_path)
1071-
for name in files if is_about_file(name)]
10721095

10731096
@property
10741097
def errors(self):
@@ -1193,7 +1216,7 @@ def generate_attribution(self, template_path=None, limit_to=None):
11931216
errors='replace')
11941217
about_content_dict['notice_text'] = about_object.notice_text()
11951218

1196-
# FIXME: The following is a tmp code to handle multiple
1219+
# FIXME: The following is a tmp code to handle multiple
11971220
# 'license_text_file' in the input
11981221
for k in about_content_dict:
11991222
if '\n' in about_content_dict[k] and k == 'license_text_file':

0 commit comments

Comments
 (0)