Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
17555e1
Bump dependencies to current versions #280 #291
pombredanne Nov 3, 2017
acb88ea
Use unicode everywhere, cleanup imports #280
pombredanne Nov 3, 2017
265f05d
Improve error string handling. Make test pass on Py2 #280
pombredanne Nov 3, 2017
9692334
Bump pyyaml to 3.12 #280
pombredanne Nov 3, 2017
9a8cda7
Cleanup test for py.test warning #280
pombredanne Nov 3, 2017
9303ad7
Always use with to open files #280
pombredanne Nov 3, 2017
db4c37b
Improve Python3 portability #280
pombredanne Nov 3, 2017
6b44f6c
Use backports.csv rather than unicodecsv #280
pombredanne Nov 4, 2017
1b23580
Do not use a global for mapping #280
pombredanne Nov 5, 2017
eb156e3
Format code
pombredanne Nov 6, 2017
079e388
Use proper deps versions #280
pombredanne Nov 6, 2017
0f080d9
Update README CI links and badges
pombredanne Nov 6, 2017
ea3b522
Silence click unicode literals warnings #280
pombredanne Nov 6, 2017
5d05d27
Clean error messages from double \\ #280
pombredanne Nov 6, 2017
db4427c
Correct tests for unicode and CSV #280
pombredanne Nov 6, 2017
c0fdb95
Use CSV on Python3 and improve CLI help #280
pombredanne Nov 6, 2017
0059953
Do not require backports.csv on Python3 #280
pombredanne Nov 6, 2017
aaf83c4
Minor edits to README.rst and setup.py to reflect Python 3 compatibil…
tdruez Nov 7, 2017
a7d053a
Merge branch 'develop' into 291-280-python3-support
tdruez Nov 7, 2017
05e4d92
Merge develop resolving conflicts #280
chinyeungli Nov 8, 2017
0629a1d
Do not use datafiles in setup.py #280
pombredanne Nov 8, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: python

python:
- "2.7"
- "3.6"

install:
- ./configure etc/conf/dev
Expand Down
35 changes: 27 additions & 8 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
include *.ABOUT
include about*
include *LICENSE*
include *NOTICE*
include *README*
graft src
graft tests
graft docs
graft etc
graft example
graft thirdparty

prune src/aboutcode_toolkit.egg-info

include about.ABOUT
include about
include about.bat
include about.cfg
include apache-2.0.LICENSE
include about.bat
include apache-2.0.LICENSE
include configure
include configure.bat
include MANIFEST.in
include NOTICE
include README.rst
include setup.cfg
include setup.py
include SPEC
include USAGE.rst
include *SPEC*
include .travis.yml
include appveyor.yml

recursive-include tests/testdata *
recursive-include about_code_tool/templates *
global-exclude *.py[co] __pycache__ *.*~
31 changes: 19 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
AboutCode toolkit
=================

.. image:: https://api.travis-ci.org/nexB/aboutcode-toolkit.png?branch=develop
:target: https://travis-ci.org/nexB/aboutcode-toolkit

.. image:: https://coveralls.io/repos/nexB/aboutcode-toolkit/badge.png?branch=develop
:target: https://coveralls.io/r/nexB/aboutcode-toolkit?branch=develop
Build and tests status
----------------------

+-------+-------------------------------------------------------------------------------+-------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
|Branch | **Linux (Travis)** | **MacOSX (Travis)** | **Windows (AppVeyor)** |
+=======+===============================================================================+===============================================================================+======================================================================================================+
| |.. image:: https://api.travis-ci.org/nexB/aboutcode-toolkit.png?branch=master |.. image:: https://api.travis-ci.org/nexB/aboutcode-toolkit.png?branch=master |.. image:: https://ci.appveyor.com/api/projects/status/nexB/aboutcode-toolkit/branch/master?png=true |
|Master | :target: https://travis-ci.org/nexB/aboutcode-toolkit | :target: https://travis-ci.org/nexB/aboutcode-toolkit | :target: https://ci.appveyor.com/project/nexB/aboutcode-toolkit |
| | :alt: Linux Master branch tests status | :alt: MacOSX Master branch tests status | :alt: Windows Master branch tests status |
+-------+-------------------------------------------------------------------------------+-------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| |.. image:: https://api.travis-ci.org/nexB/aboutcode-toolkit.png?branch=develop |.. image:: https://api.travis-ci.org/nexB/aboutcode-toolkit.png?branch=develop |.. image:: https://ci.appveyor.com/api/projects/status/nexB/aboutcode-toolkit/branch/develop?png=true |
|Develop| :target: https://travis-ci.org/nexB/aboutcode-toolkit | :target: https://travis-ci.org/nexB/aboutcode-toolkit | :target: https://ci.appveyor.com/project/nexB/aboutcode-toolkit |
| | :alt: Linux Develop branch tests status | :alt: MacOSX Develop branch tests status | :alt: Windows Develop branch tests status |
+-------+-------------------------------------------------------------------------------+-------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------+


The AboutCode toolkit and ABOUT files provide a simple way to document the
Expand All @@ -32,17 +41,16 @@ https://github.com/nexB/aboutcode-toolkit/blob/master/SPEC

REQUIREMENTS
------------
The AboutCode toolkit is tested with 2.7 on Linux, Mac and Windows.
The AboutCode toolkit is tested with Python 2.7 and 3.6 on Linux, Mac and Windows.
You will need to install a Python interpreter if you do not have one already
installed.

On Linux and Mac, Python is typically pre-installed. To verify which
version may be pre-installed, open a terminal and type::

python --version
python2.7 --version

On Windows or Mac, you can download the latest Python 2.7.x here:
On Windows or Mac, you can download the latest Python here:
https://www.python.org/downloads/

Download the .msi installer for Windows or the .dmg archive for Mac.
Expand All @@ -55,7 +63,7 @@ Checkout or download and extract the AboutCode toolkit from:
https://github.com/nexB/aboutcode-toolkit/

To install all the needed dependencies in a virtualenv, run (on posix)::
source configure
source configure
or on windows::
configure

Expand All @@ -65,8 +73,8 @@ USAGE
See https://github.com/nexB/aboutcode-toolkit/blob/master/USAGE.rst for USAGE.


TESTS and DEVLOPMENT
--------------------
TESTS and DEVELOPMENT
---------------------
To install all the needed development dependencies, run (on posix)::
source configure etc/conf/dev
or on windows::
Expand All @@ -76,7 +84,6 @@ To verify that everything works fine you can run the test suite with::
py.test



HELP and SUPPORT
----------------
If you have a question or find a bug, enter a ticket at:
Expand Down
6 changes: 3 additions & 3 deletions about.ABOUT
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
about_resource: .

name: AboutCode
version: 3.0.0.dev4
name: AboutCode-toolkit
version: 3.0.0.dev6

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

home_url: http://dejacode.org
home_url: https://aboutcode.org

vcs_tool: git
vcs_repository: https://github.com/dejacode/about-code-tool.git
Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fi

CONFIGURE_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

python2.7 $CONFIGURE_ROOT_DIR/etc/configure.py $CFG_CMD_LINE_ARGS
python $CONFIGURE_ROOT_DIR/etc/configure.py $CFG_CMD_LINE_ARGS
if [ -f "$CONFIGURE_ROOT_DIR/bin/activate" ]; then
source $CONFIGURE_ROOT_DIR/bin/activate
fi
11 changes: 4 additions & 7 deletions etc/conf/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ pip
wincertstore

# used for templating
jinja2==2.7.3
MarkupSafe==0.23
jinja2==2.9.6
MarkupSafe==1.0.0

click==3.3
click==6.7

# used by schematics
six

pyyaml==3.11


unicodecsv==0.9.4
pyyaml==3.12

# license expression support
license_expression
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ universal = 1
license_file = NOTICE

[aliases]
release = clean --all sdist --formats=bztar,zip bdist_wheel register upload
release = clean --all sdist --formats=bztar,zip bdist_wheel

[pytest]
[tool:pytest]
norecursedirs =
.git
bin
Expand Down
79 changes: 30 additions & 49 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- encoding: utf-8 -*-

from __future__ import absolute_import
from __future__ import print_function
Expand All @@ -10,6 +10,7 @@
from os.path import dirname
from os.path import join
from os.path import splitext

from setuptools import find_packages
from setuptools import setup

Expand All @@ -22,16 +23,20 @@ def read(*names, **kwargs):


setup(
name='attributecode',
version='3.0.0.dev4',
name='aboutcode-toolkit',
version='3.0.0.dev6',
license='Apache-2.0',
description=('Document the provenance (origin and license) of '
'third-party software using small text files. '
'Collect inventories, generate attribution documentation.'),
long_description=('AttributeCode provides a simple way to document the'
description=(
'AboutCode-toolkit is a tool to document the provenance (origin and license) of '
'third-party software using small text files. '
'Collect inventories, generate attribution documentation.'
),
long_description=(
'AttributeCode provides a simple way to document the'
'provenance (i.e. origin and license) of software components that'
'you use in your project. This documentation is stored in *.ABOUT'
'files, side-by-side with the documented code.'),
'files, side-by-side with the documented code.'
),
author='Chin-Yeung Li, Jillian Daguil, Thomas Druez, Philippe Ombredanne and others.',
author_email='info@nexb.com',
url='http://aboutcode.org',
Expand All @@ -46,59 +51,35 @@ def read(*names, **kwargs):
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Intended Audience :: Developers',
'Topic :: Software Development',
'Topic :: Software Development :: Documentation',
'Topic :: Software Development :: Quality Assurance',
'Topic :: System :: Software Distribution',
'Topic :: Utilities',
],
keywords=[
'license', 'about', 'metadata', 'package', 'copyright',
'license', 'about', 'metadata', 'package', 'copyright',
'attribution', 'software', 'inventory',
],
data_files=[('about',
[
'about.ABOUT',
'about.bat',
'about',
'configure.bat',
'configure',
'about.cfg',
'README.rst',
'apache-2.0.LICENSE',
'NOTICE',
'SPEC',
'USAGE.rst',
]),
],

entry_points='''
[console_scripts]
about-code=attributecode.cmd:cli
''',
install_requires=[
'jinja2 >= 2.7.3, < 2.8',
'click >= 3.2, < 4',
'unicodecsv >= 0.9.4, < 1.0',
'jinja2 >= 2.9, < 3.0',
'click >= 6.7, < 7.0',
"backports.csv ; python_version<'3.6'",
'pyyaml >= 3.11, < 3.13',
'boolean.py',
'license_expression',
],

'boolean.py >= 3.5, < 4.0',
'license_expression >= 0.94, < 1.0',
],
extras_require={
'base': [
'certifi',
'setuptools',
'wheel',
'pip',
'wincertstore',
],
'dev': [
'pytest',
'py',
],
}
":python_version < '3.6'": ['backports.csv'],
},
entry_points={
'console_scripts': [
'about-code=attributecode.cmd:cli',
]
},
)
56 changes: 47 additions & 9 deletions src/attributecode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,26 @@
# limitations under the License.
# ============================================================================


from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals

from collections import namedtuple
import logging

__version__ = '3.0.0.dev5'
try:
basestring # Python 2
except NameError:
basestring = str # Python 3


__version__ = '3.0.0.dev6'


__about_spec_version__ = '2.0.0.dev2'

__copyright__ = """
Copyright (c) 2013-2016 nexB Inc. All rights reserved. http://dejacode.org
Copyright (c) 2013-2017 nexB Inc. All rights reserved. http://dejacode.org
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -38,15 +45,46 @@
limitations under the License.
"""

Error = namedtuple('Error', ['severity', 'message'])

def error_repr(self):
sev = severities[self.severity]
msg = self.message
return 'Error(%(sev)s, %(msg)r)' % locals()
class Error(namedtuple('Error', ['severity', 'message'])):
"""
An Error data with a severity and message.
"""
def __new__(self, severity, message):
if message:
if isinstance(message, basestring):
message = clean_string(message)
else:
message = clean_string(repr(message))

return super(Error, self).__new__(
Error, severity, message)

def __repr__(self, *args, **kwargs):
sev = severities[self.severity]
msg = clean_string(repr(self.message))
return 'Error(%(sev)s, %(msg)s)' % locals()

Error.__repr__ = error_repr

def clean_string(s):
"""
Return a cleaned string for `s`, stripping eventual "u" prefixes
from unicode representations.
"""
if not s:
return s
if s.startswith(('u"', "u'")):
s = s.lstrip('u')
s = s.replace('[u"', '["')
s = s.replace("[u'", "['")
s = s.replace("(u'", "('")
s = s.replace("(u'", "('")
s = s.replace("{u'", "{'")
s = s.replace("{u'", "{'")
s = s.replace(" u'", " '")
s = s.replace(" u'", " '")
s = s.replace("\\\\", "\\")
return s

# modeled after the logging levels
CRITICAL = 50
Expand Down
Loading