Skip to content

Commit

Permalink
Fixed #241:
Browse files Browse the repository at this point in the history
`about_file_path` and `about_resource_path` will begin with '/'
`about_resource_path` will end with '/' if `about_resource` is '.'
  • Loading branch information
chinyeungli committed Mar 16, 2016
1 parent 42c91d9 commit bb9341e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
13 changes: 13 additions & 0 deletions about_code_tool/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,19 @@ def to_csv(abouts, location, with_absent=False, with_empty=True):
ad = a.as_dict(with_paths=True,
with_absent=with_absent,
with_empty=with_empty)
if 'about_file_path' in ad.keys():
afp = ad['about_file_path']
afp = '/' + afp if not afp.startswith('/') else afp
ad['about_file_path'] = afp
if 'about_resource_path' in ad.keys():
arp = ad['about_resource_path']
arp = '/' + arp if not arp.startswith('/') else arp
ad['about_resource_path'] = arp
# Make the 'about_resource_path' endswith '/' if the 'about_resource'
# reference the current directory
if 'about_resource' in ad.keys() and ad['about_resource'] == '.':
if not ad['about_resource_path'].endswith('/'):
ad['about_resource_path'] += '/'
writer.writerow(ad)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
about_file_path,about_resource_path,about_resource,name,version,download_url,description,home_url,notes,license,license_name,license_file,license_url,copyright,notice_file,notice_url,redistribute,attribute,track_change,modified,changelog_file,owner,owner_url,contact,author,vcs_tool,vcs_repository,vcs_path,vcs_tag,vcs_branch,vcs_revision,checksum,spec_version
about/about.ABOUT,about,.,AboutCode,0.11.0,,"AboutCode is a tool to process ABOUT files. An ABOUT file is a file.",http://dejacode.org,,apache-2.0,,apache-2.0.LICENSE,,Copyright (c) 2013-2014 nexB Inc.,NOTICE,,,,,,,nexB Inc.,,,"Jillian Daguil, Chin Yeung Li, Philippe Ombredanne, Thomas Druez",git,https://github.com/dejacode/about-code-tool.git,,,,,,
/about/about.ABOUT,/about/,.,AboutCode,0.11.0,,AboutCode is a tool to process ABOUT files. An ABOUT file is a file.,http://dejacode.org,,apache-2.0,,apache-2.0.LICENSE,,Copyright (c) 2013-2014 nexB Inc.,NOTICE,,,,,,,nexB Inc.,,,"Jillian Daguil, Chin Yeung Li, Philippe Ombredanne, Thomas Druez",git,https://github.com/dejacode/about-code-tool.git,,,,,,
32 changes: 16 additions & 16 deletions about_code_tool/tests/testdata/inventory/complex/expected.csv
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
about_file_path,about_resource_path,about_resource,name,version,download_url,description,home_url,notes,license,license_name,license_file,license_url,copyright,notice_file,notice_url,redistribute,attribute,track_change,modified,changelog_file,owner,owner_url,contact,author,vcs_tool,vcs_repository,vcs_path,vcs_tag,vcs_branch,vcs_revision,checksum,spec_version,author_file,dje_license,keywords,license_text_file
about/about.ABOUT,about,.,AboutCode,0.11.0,,"AboutCode is a tool
/about/about.ABOUT,/about/,.,AboutCode,0.11.0,,"AboutCode is a tool
to process ABOUT files.
An ABOUT file is a file.",http://dejacode.org,,apache-2.0,,apache-2.0.LICENSE,,Copyright (c) 2013-2014 nexB Inc.,NOTICE,,,,,,,nexB Inc.,,,"Jillian Daguil, Chin Yeung Li, Philippe Ombredanne, Thomas Druez",git,https://github.com/dejacode/about-code-tool.git,,,,,,,,,,
about/certifi.ABOUT,about/certifi-14.05.14-py2.py3-none-any.whl,certifi-14.05.14-py2.py3-none-any.whl,certifi,14.05.14,,Python package for providing Mozilla's CA Bundle.,http://python-requests.org,,,,,,,,,,,,,,Kenneth Reitz,,me@kennethreitz.com,,,,,,,,,,,mpl-2.0,,
about/click.ABOUT,about/click-3.2-py2.py3-none-any.whl,click-3.2-py2.py3-none-any.whl,click,3.2,https://pypi.python.org/packages/2.7/c/click/click-3.2-py2.py3-none-any.whl#md5=7d0bf0ca4e8ce6056e35cc8135d21abd,"A simple wrapper around optparse for
/about/certifi.ABOUT,/about/certifi-14.05.14-py2.py3-none-any.whl,certifi-14.05.14-py2.py3-none-any.whl,certifi,14.05.14,,Python package for providing Mozilla's CA Bundle.,http://python-requests.org,,,,,,,,,,,,,,Kenneth Reitz,,me@kennethreitz.com,,,,,,,,,,,mpl-2.0,,
/about/click.ABOUT,/about/click-3.2-py2.py3-none-any.whl,click-3.2-py2.py3-none-any.whl,click,3.2,https://pypi.python.org/packages/2.7/c/click/click-3.2-py2.py3-none-any.whl#md5=7d0bf0ca4e8ce6056e35cc8135d21abd,"A simple wrapper around optparse for
powerful command line utilities.",http://click.pocoo.org/,"Click uses parts of optparse written by Gregory P. Ward and maintained
by the Python software foundation. This is limited to code in the parser.py
module and is under the same license as clikc itself.",,,,,,,,,,,,,Armin Ronacher,,armin.ronacher@active-4.com,,git,https://github.com/mitsuhiko/click.git,,,,,,,,bsd-new,,click.LICENSE
about/colorama.ABOUT,about/colorama-0.3.1-py2-none-any.whl,colorama-0.3.1-py2-none-any.whl,colorama,0.3.1,https://pypi.python.org/packages/source/c/colorama/colorama-0.3.1.tar.gz#md5=95ce8bf32f5c25adea14b809db3509cb,Cross-platform colored terminal text.,https://pypi.python.org/pypi/colorama,,,,,,,,,,,,,,Jonathan Hartley,,tartley@tartley.com,,,,,,,,,,,bds-new,color colour terminal text ansi windows crossplatform xplatform,colorama.LICENSE
about/Jinja2.ABOUT,about/Jinja2-2.7.3-py2-none-any.whl,Jinja2-2.7.3-py2-none-any.whl,Jinja2,2.7.3,https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz#md5=b9dffd2f3b43d673802fe857c8445b1a,,http://jinja.pocoo.org/,,,,,,Copyright (c) 2009 by the Jinja Team,,,,,,,,Armin Ronacher,,,,git,https://github.com/mitsuhiko/jinja2.git,,,,,,,,bsd-new,,Jinja2.LICENSE
about/MarkupSafe.ABOUT,about/MarkupSafe-0.23-py2-none-any.whl,MarkupSafe-0.23-py2-none-any.whl,MarkupSafe,0.23,https://pypi.python.org/packages/source/m/MarkupSafe/MarkupSafe-0.23.tar.gz,,https://github.com/mitsuhiko/markupsafe,,,,,,Copyright (c) 2010 by Armin Ronacher and contributors.,,,,,,,,Armin Ronacher,,,,git,https://github.com/mitsuhiko/jinja2.git,,,,,,,,bsd-new,,MarkupSafe.LICENSE
about/pip.ABOUT,about/pip-1.5.6-py2.py3-none-any.whl,pip-1.5.6-py2.py3-none-any.whl,pip,1.5.6,https://pypi.python.org/packages/source/p/pip/pip-1.5.6.tar.gz#md5=01026f87978932060cc86c1dc527903e,,http://www.pip-installer.org,,,,,,,,,,,,,,The pip developers,,python-virtualenv@groups.google.com,,git,https://github.com/pypa/pip.git,,,,,,,pip.AUTHORS,"mit, lgpl-2.1",,pip.LICENSE
about/py.ABOUT,about/py-1.4.23-py2-none-any.whl,py-1.4.23-py2-none-any.whl,py,1.4.23,https://pypi.python.org/packages/source/p/py/py-1.4.23.tar.gz#md5=b40aea711eeb8adba0c44f0b750a3205,"library with cross-python path, ini-parsing, io, code, log facilities",http://pylib.readthedocs.org/,,,,,,"Holger Krekel and others, 2004-2014",,,,,,,,"holger krekel, Ronny Pfannschmidt, Benjamin Peterson and others",,pytest-dev@python.org,,,,,,,,,,,mit,,py.LICENSE
about/pytest.ABOUT,about/pytest-2.6.1-py2.py3-none-any.whl,pytest-2.6.1-py2.py3-none-any.whl,pytest,2.6.1,https://pypi.python.org/packages/source/p/pytest/pytest-2.6.1.tar.gz#md5=bb353f6cf6d9ff83ff7f2dfbeaca47a3,pytest - simple powerful testing with Python,http://pytest.org,,,,,,"Copyright Holger Krekel and others, 2004-2014",,,,,,,,"Holger Krekel, Benjamin Peterson, Ronny Pfannschmidt, Floris Bruynooghe and others",,holger at merlinux.eu,,,,,,,,,,,mit,,pytest.LICENSE
about/schematics.ABOUT,about/schematics-0.9_5-py2-none-any.whl,schematics-0.9_5-py2-none-any.whl,schematics,0.9-5,https://pypi.python.org/packages/source/s/schematics/schematics-0.9-5.tar.gz#md5=82ba0d67aa2600421877edcd9e7500f7,,https://github.com/schematics/schematics,,,,,,"Copyright (c) 2013, J2 Labs LLC.",,,,,,,,J2 Labs LLC.,,,,,,,,,,,,,bsd-new,,schematics.LICENSE
about/setuptools.ABOUT,about/setuptools-5.6-py2.py3-none-any.whl,setuptools-5.6-py2.py3-none-any.whl,setuptools,5.6,https://pypi.python.org/packages/3.4/s/setuptools/setuptools-5.6-py2.py3-none-any.whl#md5=4503e42d67edc51e293ba9be4af799a5,,https://pypi.python.org/pypi/setuptools,,,,,,,,,,,,,,Python Packaging Authority,,,,,,,,,,,,,psf,,PSF.LICENSE
about/unicodecsv.ABOUT,about/unicodecsv-0.9.4-py2-none-any.whl,unicodecsv-0.9.4-py2-none-any.whl,unicodecsv,0.9.4,https://pypi.python.org/packages/source/u/unicodecsv/unicodecsv-0.9.4.tar.gz#md5=344fa55f299ba198cb73db48546002fd,,https://github.com/jdunck/python-unicodecsv,,,,,,,,,,,,,,Jeremy Dunck,,,,git,https://github.com/jdunck/python-unicodecsv.git,,,,,,,,bsd-new,,unicodecsv.LICENSE
about/virtualenv.ABOUT,about/virtualenv-1.11.6-py2.py3-none-any.whl,virtualenv-1.11.6-py2.py3-none-any.whl,virtualenv,1.11.6,https://raw.githubusercontent.com/pypa/virtualenv/1.11.6/virtualenv.py,,http://virtualenv.org/,,,,,https://raw.github.com/pypa/virtualenv/develop/LICENSE.txt,"Copyright (c) 2007 Ian Bicking and Contributors
/about/colorama.ABOUT,/about/colorama-0.3.1-py2-none-any.whl,colorama-0.3.1-py2-none-any.whl,colorama,0.3.1,https://pypi.python.org/packages/source/c/colorama/colorama-0.3.1.tar.gz#md5=95ce8bf32f5c25adea14b809db3509cb,Cross-platform colored terminal text.,https://pypi.python.org/pypi/colorama,,,,,,,,,,,,,,Jonathan Hartley,,tartley@tartley.com,,,,,,,,,,,bds-new,color colour terminal text ansi windows crossplatform xplatform,colorama.LICENSE
/about/Jinja2.ABOUT,/about/Jinja2-2.7.3-py2-none-any.whl,Jinja2-2.7.3-py2-none-any.whl,Jinja2,2.7.3,https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz#md5=b9dffd2f3b43d673802fe857c8445b1a,,http://jinja.pocoo.org/,,,,,,Copyright (c) 2009 by the Jinja Team,,,,,,,,Armin Ronacher,,,,git,https://github.com/mitsuhiko/jinja2.git,,,,,,,,bsd-new,,Jinja2.LICENSE
/about/MarkupSafe.ABOUT,/about/MarkupSafe-0.23-py2-none-any.whl,MarkupSafe-0.23-py2-none-any.whl,MarkupSafe,0.23,https://pypi.python.org/packages/source/m/MarkupSafe/MarkupSafe-0.23.tar.gz,,https://github.com/mitsuhiko/markupsafe,,,,,,Copyright (c) 2010 by Armin Ronacher and contributors.,,,,,,,,Armin Ronacher,,,,git,https://github.com/mitsuhiko/jinja2.git,,,,,,,,bsd-new,,MarkupSafe.LICENSE
/about/pip.ABOUT,/about/pip-1.5.6-py2.py3-none-any.whl,pip-1.5.6-py2.py3-none-any.whl,pip,1.5.6,https://pypi.python.org/packages/source/p/pip/pip-1.5.6.tar.gz#md5=01026f87978932060cc86c1dc527903e,,http://www.pip-installer.org,,,,,,,,,,,,,,The pip developers,,python-virtualenv@groups.google.com,,git,https://github.com/pypa/pip.git,,,,,,,pip.AUTHORS,"mit, lgpl-2.1",,pip.LICENSE
/about/py.ABOUT,/about/py-1.4.23-py2-none-any.whl,py-1.4.23-py2-none-any.whl,py,1.4.23,https://pypi.python.org/packages/source/p/py/py-1.4.23.tar.gz#md5=b40aea711eeb8adba0c44f0b750a3205,"library with cross-python path, ini-parsing, io, code, log facilities",http://pylib.readthedocs.org/,,,,,,"Holger Krekel and others, 2004-2014",,,,,,,,"holger krekel, Ronny Pfannschmidt, Benjamin Peterson and others",,pytest-dev@python.org,,,,,,,,,,,mit,,py.LICENSE
/about/pytest.ABOUT,/about/pytest-2.6.1-py2.py3-none-any.whl,pytest-2.6.1-py2.py3-none-any.whl,pytest,2.6.1,https://pypi.python.org/packages/source/p/pytest/pytest-2.6.1.tar.gz#md5=bb353f6cf6d9ff83ff7f2dfbeaca47a3,pytest - simple powerful testing with Python,http://pytest.org,,,,,,"Copyright Holger Krekel and others, 2004-2014",,,,,,,,"Holger Krekel, Benjamin Peterson, Ronny Pfannschmidt, Floris Bruynooghe and others",,holger at merlinux.eu,,,,,,,,,,,mit,,pytest.LICENSE
/about/schematics.ABOUT,/about/schematics-0.9_5-py2-none-any.whl,schematics-0.9_5-py2-none-any.whl,schematics,0.9-5,https://pypi.python.org/packages/source/s/schematics/schematics-0.9-5.tar.gz#md5=82ba0d67aa2600421877edcd9e7500f7,,https://github.com/schematics/schematics,,,,,,"Copyright (c) 2013, J2 Labs LLC.",,,,,,,,J2 Labs LLC.,,,,,,,,,,,,,bsd-new,,schematics.LICENSE
/about/setuptools.ABOUT,/about/setuptools-5.6-py2.py3-none-any.whl,setuptools-5.6-py2.py3-none-any.whl,setuptools,5.6,https://pypi.python.org/packages/3.4/s/setuptools/setuptools-5.6-py2.py3-none-any.whl#md5=4503e42d67edc51e293ba9be4af799a5,,https://pypi.python.org/pypi/setuptools,,,,,,,,,,,,,,Python Packaging Authority,,,,,,,,,,,,,psf,,PSF.LICENSE
/about/unicodecsv.ABOUT,/about/unicodecsv-0.9.4-py2-none-any.whl,unicodecsv-0.9.4-py2-none-any.whl,unicodecsv,0.9.4,https://pypi.python.org/packages/source/u/unicodecsv/unicodecsv-0.9.4.tar.gz#md5=344fa55f299ba198cb73db48546002fd,,https://github.com/jdunck/python-unicodecsv,,,,,,,,,,,,,,Jeremy Dunck,,,,git,https://github.com/jdunck/python-unicodecsv.git,,,,,,,,bsd-new,,unicodecsv.LICENSE
/about/virtualenv.ABOUT,/about/virtualenv-1.11.6-py2.py3-none-any.whl,virtualenv-1.11.6-py2.py3-none-any.whl,virtualenv,1.11.6,https://raw.githubusercontent.com/pypa/virtualenv/1.11.6/virtualenv.py,,http://virtualenv.org/,,,,,https://raw.github.com/pypa/virtualenv/develop/LICENSE.txt,"Copyright (c) 2007 Ian Bicking and Contributors
Copyright (c) 2009 Ian Bicking, The Open Planning Project
Copyright (c) 2011-2014 The virtualenv developers",,,,,,,,The virtualenv developers,,,,git,https://github.com/pypa/virtualenv.git,,,,,,,,mit,,virtualenv.LICENSE
about/virtualenv.py.ABOUT,about/virtualenv.py,virtualenv.py,virtualenv,1.11.6,https://raw.githubusercontent.com/pypa/virtualenv/1.11.6/virtualenv.py,,http://virtualenv.org/,,,,,https://raw.github.com/pypa/virtualenv/develop/LICENSE.txt,"Copyright (c) 2007 Ian Bicking and Contributors
/about/virtualenv.py.ABOUT,/about/virtualenv.py,virtualenv.py,virtualenv,1.11.6,https://raw.githubusercontent.com/pypa/virtualenv/1.11.6/virtualenv.py,,http://virtualenv.org/,,,,,https://raw.github.com/pypa/virtualenv/develop/LICENSE.txt,"Copyright (c) 2007 Ian Bicking and Contributors
Copyright (c) 2009 Ian Bicking, The Open Planning Project
Copyright (c) 2011-2014 The virtualenv developers",,,,,,,,The virtualenv developers,,,,git,https://github.com/pypa/virtualenv.git,,,,,,,,mit,,virtualenv.LICENSE
about/wheel.ABOUT,about/wheel-0.24.0-py2.py3-none-any.whl,wheel-0.24.0-py2.py3-none-any.whl,wheel,0.24.0,https://pypi.python.org/packages/py2.py3/w/wheel/wheel-0.24.0-py2.py3-none-any.whl#md5=4c24453cda2177fd42c5d62d6434679a,,https://bitbucket.org/pypa/wheel,,,,,,"copyright (c) 2012-2014 Daniel Holth <dholth@fastmail.fm> and
/about/wheel.ABOUT,/about/wheel-0.24.0-py2.py3-none-any.whl,wheel-0.24.0-py2.py3-none-any.whl,wheel,0.24.0,https://pypi.python.org/packages/py2.py3/w/wheel/wheel-0.24.0-py2.py3-none-any.whl#md5=4c24453cda2177fd42c5d62d6434679a,,https://bitbucket.org/pypa/wheel,,,,,,"copyright (c) 2012-2014 Daniel Holth <dholth@fastmail.fm> and
contributors.",,,,,,,,,,,,hg,https://bitbucket.org/pypa/wheel,,,,,,,,mit,,wheel.LICENSE
about/wincertstore.ABOUT,about/wincertstore-0.2-py2.py3-none-any.whl,wincertstore-0.2-py2.py3-none-any.whl,wincertstore,0.2,https://pypi.python.org/packages/source/w/wincertstore/wincertstore-0.2.zip,Python module to extract CA and CRL certs from Windows' cert store (ctypes based).,https://bitbucket.org/tiran/wincertstore,,,,,,,,,,,,,,Christian Heimes,,christian@python.org,,,,,,,,,,,psf,,wincertstore.LICENSE
/about/wincertstore.ABOUT,/about/wincertstore-0.2-py2.py3-none-any.whl,wincertstore-0.2-py2.py3-none-any.whl,wincertstore,0.2,https://pypi.python.org/packages/source/w/wincertstore/wincertstore-0.2.zip,Python module to extract CA and CRL certs from Windows' cert store (ctypes based).,https://bitbucket.org/tiran/wincertstore,,,,,,,,,,,,,,Christian Heimes,,christian@python.org,,,,,,,,,,,psf,,wincertstore.LICENSE
2 changes: 1 addition & 1 deletion about_code_tool/tests/testdata/load/expected.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
about_file_path,about_resource_path,about_resource,name,version,download_url,description,home_url,notes,license,license_name,license_file,license_url,copyright,notice_file,notice_url,redistribute,attribute,track_change,modified,changelog_file,owner,owner_url,contact,author,vcs_tool,vcs_repository,vcs_path,vcs_tag,vcs_branch,vcs_revision,checksum,spec_version,custom1
load/this.ABOUT,load,.,AboutCode,0.11.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"multi
/load/this.ABOUT,/load/,.,AboutCode,0.11.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"multi
line"

0 comments on commit bb9341e

Please sign in to comment.