Skip to content

Commit 8584d7d

Browse files
committed
Merge branch 'develop'
2 parents 6a765da + ef99db0 commit 8584d7d

File tree

203 files changed

+4172
-21738
lines changed

Some content is hidden

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

203 files changed

+4172
-21738
lines changed

.coveragerc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[run]
22
source = pygccxml,docs/example,unittests
33
parallel = True
4-
append = .coverage
54

65
[report]
76
# Regexes for lines to exclude from consideration

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
*.pyc
22
*~
33
docs/_build
4+
unittests/temp
5+
unittests/data/pygccxml.cache
6+
.idea

.travis.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,25 @@ python:
77
- "3.2"
88
- "3.3"
99
- "3.4"
10+
- "3.5"
1011

1112
before_install:
1213
# Install gccxml
1314
- sudo apt-get update -qq
1415
- sudo apt-get install -qq gccxml
1516
# Install pep8, needed by the unit tests
1617
- pip install pep8
17-
# Install coverage tools
18-
- pip install coverage
18+
# Install coverage tools (On 3.2 the new coverage is broken, use an old one)
19+
# https://github.com/menegazzo/travispy/issues/20
20+
- if [ $TRAVIS_PYTHON_VERSION == 3.2 ];
21+
then pip install 'coverage<4.0'; else
22+
pip install coverage;
23+
fi
1924
- pip install coveralls
2025

26+
install:
27+
- if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install unittest2; fi
28+
2129
script:
2230
# Modify sitecustomize.py file for coverage. Allows to cover files run in a subprocess.
2331
- touch "/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/lib/python${TRAVIS_PYTHON_VERSION}/sitecustomize.py"

Makefile

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,12 @@ SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = docs/_build
9-
GH_PAGES_SOURCES = docs pygccxml Makefile
109

1110
# User-friendly check for sphinx-build
1211
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
1312
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
1413
endif
1514

16-
# Check if the spinx version is the right one. Sphinx does not allow to check for
17-
# minor sphinx revisions in conf.py, so we have to do this check here.
18-
# This is needed because it the doc is uploaded to the git pages, we don't want
19-
# to merge in changes due to a sphinx version change.
20-
ifeq ($(shell $(SPHINXBUILD) --version | grep -q "1.2.2" >/dev/null 2>&1; echo $$?), 1)
21-
$(error You need sphinx 1.2.2 to build the documentation !)
22-
endif
23-
2415
# Internal variables.
2516
PAPEROPT_a4 = -D latex_paper_size=a4
2617
PAPEROPT_letter = -D latex_paper_size=letter
@@ -184,16 +175,3 @@ pseudoxml:
184175
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
185176
@echo
186177
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
187-
188-
gh-pages:
189-
git checkout gh-pages
190-
rm -rf docs/*
191-
rm -rf documentation/*
192-
git checkout master $(GH_PAGES_SOURCES)
193-
git reset HEAD
194-
make html
195-
mv -fv docs/_build/html/* documentation
196-
rm -rf $(GH_PAGES_SOURCES)
197-
rm -rf documentation/_sources
198-
git add -A
199-
git commit -m "Generated gh-pages for `git log master -1 --pretty=short --abbrev-commit`"

README.rst

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
pygccxml
22
========
33

4-
.. image:: https://travis-ci.org/gccxml/pygccxml.svg?branch=master
4+
.. image:: https://travis-ci.org/gccxml/pygccxml.svg?branch=develop
55
:target: https://travis-ci.org/gccxml/pygccxml
6-
.. image:: https://coveralls.io/repos/gccxml/pygccxml/badge.png?branch=master
7-
:target: https://coveralls.io/r/gccxml/pygccxml?branch=master
8-
9-
pygccxml is a specialized XML reader that reads the output from GCCXML. It provides a simple framework to navigate C++ declarations, using Python classes.
6+
:alt: Unit tests status
7+
.. image:: https://coveralls.io/repos/gccxml/pygccxml/badge.svg?branch=develop
8+
:target: https://coveralls.io/r/gccxml/pygccxml?branch=develop
9+
:alt: Code coverage status
10+
.. image:: https://readthedocs.org/projects/pygccxml/badge/?version=develop
11+
:target: https://readthedocs.org/projects/pygccxml/?badge=develop
12+
:alt: Documentation status
13+
.. image:: https://www.quantifiedcode.com/api/v1/project/117af14ef32a455fb7b3762e21083fb3/snapshot/origin:develop:HEAD/badge.svg
14+
:target: https://www.quantifiedcode.com/app/project/117af14ef32a455fb7b3762e21083fb3?branch=origin%2Fdevelop&tab=basics
15+
:alt: Code quality status
16+
17+
pygccxml is a specialized XML reader that reads the output from CastXML or GCCXML. It provides a simple framework to navigate C++ declarations, using Python classes.
1018

1119
Install
1220
-------
@@ -22,7 +30,7 @@ To install from source, you can use the usual procedure:
2230
Contact us
2331
----------
2432

25-
You can contact us through the gccxml mailing list: http://www.gccxml.org/mailman/listinfo/gccxml
33+
You can contact us through the CastXML mailing list: http://public.kitware.com/mailman/listinfo/castxml
2634

2735
For issues with pygccxml you can open an issue here: https://github.com/gccxml/pygccxml/issues
2836

docs/apidocs/declarations.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ class_declaration
5252
:undoc-members:
5353
:show-inheritance:
5454

55-
compilers
56-
---------
55+
xml_generators
56+
--------------
5757

58-
.. automodule:: pygccxml.declarations.compilers
58+
.. automodule:: pygccxml.declarations.xml_generators
5959
:members:
6060
:undoc-members:
6161
:show-inheritance:

docs/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@
4646

4747
# General information about the project.
4848
project = u'pygccxml'
49-
copyright = u'2014, Insight Software Consortium'
49+
copyright = u'2014-2015, Insight Software Consortium'
5050

5151
# The version info for the project you're documenting, acts as replacement for
5252
# |version| and |release|, also used in various other places throughout the
5353
# built documents.
5454
#
5555
# The short X.Y version.
56-
version = '1.6'
56+
version = 'v1.7.0'
5757
# The full version, including alpha/beta/rc tags.
58-
release = '1.6'
58+
release = 'v1.7.0'
5959

6060
# The language for content autogenerated by Sphinx. Refer to documentation
6161
# for a list of supported languages.
@@ -100,7 +100,7 @@
100100

101101
# The theme to use for HTML and HTML Help pages. See the documentation for
102102
# a list of builtin themes.
103-
html_theme = 'default'
103+
html_theme = 'classic'
104104

105105
# Theme options are theme-specific and customize the look and feel of a theme
106106
# further. For a list of options available for each theme, see the

docs/credits.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Contributors
2+
------------
3+
4+
Thanks to all the people that have contributed patches, bug reports and suggestions,
5+
or supported this project:
6+
7+
* Roman Yakovenko (original author)
8+
* Roman Yakovenko's wife - Yulia
9+
* Michka Popoff
10+
* Brad King
11+
* Matt Mccormick
12+
* Mark Moll
13+
* Holger Frydrych
14+
* John Pallister
15+
* Matthias Baas
16+
* Allen Bierbaum
17+
* Georgiy Dernovoy
18+
* Darren Garnier
19+
* Gottfried Ganssauge
20+
* Gaetan Lehmann
21+
* Martin Preisler
22+
* Miguel Lobo
23+
* Jeremy Sanders
24+
* Ben Schleimer
25+
* Gustavo Carneiro
26+
* Christopher Bruns
27+
* Alejandro Dubrovsky
28+
* Aron Xu

docs/download.rst

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,36 @@
22
Download & Install
33
==================
44

5-
-------------------------
6-
pygccxml on SourceForge
7-
-------------------------
5+
------------------
6+
pygccxml on Github
7+
------------------
88

9-
pygccxml project is hosted on SourceForge. Using SourceForge services you
10-
can:
9+
The pygccxml project is hosted on Github. Using Github you can:
1110

12-
1) get access to source code
13-
2) get access to latest release version of pygccxml
11+
1) get access to the source code
12+
2) create pull requests
13+
3) report bugs or ask for new features
1414

15+
------------
16+
Installation
17+
------------
1518

16-
-----------------
17-
Subversion access
18-
-----------------
19+
Note that you will need `GCC-XML`_ on your system, see section below.
1920

20-
http://sourceforge.net/svn/?group_id=118209
21+
You can use pip to install pygccxml:
2122

22-
--------
23-
Download
24-
--------
23+
pip install pygccxml
2524

26-
https://sourceforge.net/project/showfiles.php?group_id=118209
25+
To install from source, you can use the usual procedure:
2726

28-
------------
29-
Installation
30-
------------
27+
python setup.py install
3128

29+
-------
3230
GCC-XML
3331
-------
34-
There are few different ways to install GCC-XML on your system:
32+
There are few different ways to install `GCC-XML`_ on your system:
3533

36-
1. If you use Linux, than I am almost sure your system has "gccxml" package.
34+
1. If you use Linux, than I am almost sure your system provides the "gccxml" package.
3735
Consider to install it using "native"(rpm, deb, portage) packaging system.
3836

3937
.. line separator
@@ -43,20 +41,4 @@ There are few different ways to install GCC-XML on your system:
4341
is supported for Windows, Linux and Mac platforms.
4442

4543
.. _`instructions` : http://gccxml.org/HTML/Install.html
46-
47-
pygccxml
48-
--------
49-
In command prompt or shell change current directory to be "pygccxml-X.Y.Z".
50-
"X.Y.Z" is version of pygccxml. Type the following command:
51-
52-
| ``python setup.py install``
53-
54-
After this command complete, you should have installed pygccxml package.
55-
56-
------------
57-
Dependencies
58-
------------
59-
60-
* `GCC-XML`_
61-
6244
.. _`GCC-XML`: http://www.gccxml.org

docs/example/example.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 Insight Software Consortium.
1+
// Copyright 2014-2015 Insight Software Consortium.
22
// Copyright 2004-2009 Roman Yakovenko.
33
// Distributed under the Boost Software License, Version 1.0.
44
// See http://www.boost.org/LICENSE_1_0.txt

docs/example/example.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2014 Insight Software Consortium.
1+
# Copyright 2014-2015 Insight Software Consortium.
22
# Copyright 2004-2008 Roman Yakovenko.
33
# Distributed under the Boost Software License, Version 1.0.
44
# See http://www.boost.org/LICENSE_1_0.txt
@@ -9,20 +9,22 @@
99
# Find out the file location within the sources tree
1010
this_module_dir_path = os.path.abspath(
1111
os.path.dirname(sys.modules[__name__].__file__))
12-
# Find out gccxml location
13-
gccxml_09_path = os.path.join(
14-
this_module_dir_path, '..', '..', '..',
15-
'gccxml_bin', 'v09', sys.platform, 'bin')
1612
# Add pygccxml package to Python path
1713
sys.path.append(os.path.join(this_module_dir_path, '..', '..'))
1814

1915

20-
from pygccxml import parser
21-
from pygccxml import declarations
16+
from pygccxml import parser # nopep8
17+
from pygccxml import declarations # nopep8
18+
from pygccxml import utils # nopep8
2219

23-
# Configure GCC-XML parser
24-
config = parser.gccxml_configuration_t(
25-
gccxml_path=gccxml_09_path, compiler='gcc')
20+
# Find out the xml generator (gccxml or castxml)
21+
generator_path, generator_name = utils.find_xml_generator()
22+
23+
# Configure the xml generator
24+
config = parser.xml_generator_configuration_t(
25+
xml_generator_path=generator_path,
26+
xml_generator=generator_name,
27+
compiler="gcc")
2628

2729
# Parsing source file
2830
decls = parser.parse([this_module_dir_path + '/example.hpp'], config)

docs/examples.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
========
2+
Examples
3+
========
4+
5+
First examples
6+
--------------
7+
8+
.. toctree::
9+
:maxdepth: 1
10+
11+
examples/parsing/example.rst
12+
examples/variables/example.rst
13+
examples/caching/example.rst

docs/examples/caching/example.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright 2014-2015 Insight Software Consortium.
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// See http://www.boost.org/LICENSE_1_0.txt
4+
5+
namespace ns{
6+
int a = 1;
7+
}

docs/examples/caching/example.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2014-2015 Insight Software Consortium.
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# See http://www.boost.org/LICENSE_1_0.txt
4+
5+
from pygccxml import utils
6+
from pygccxml import declarations
7+
from pygccxml import parser
8+
9+
# Find out the c++ parser
10+
generator_path, generator_name = utils.find_xml_generator()
11+
12+
# Configure the xml generator
13+
xml_generator_config = parser.xml_generator_configuration_t(
14+
xml_generator_path=generator_path,
15+
xml_generator=generator_name)
16+
17+
# The c++ file we want to parse
18+
filename = "example.hpp"
19+
20+
file_config = parser.file_configuration_t(
21+
data=filename,
22+
content_type=parser.CONTENT_TYPE.CACHED_SOURCE_FILE)
23+
24+
project_reader = parser.project_reader_t(xml_generator_config)
25+
decls = project_reader.read_files(
26+
[file_config],
27+
compilation_mode=parser.COMPILATION_MODE.FILE_BY_FILE)
28+
29+
global_namespace = declarations.get_global_namespace(decls)
30+
31+
value = global_namespace.namespace("ns")
32+
print("My name is: " + value.name)

docs/examples/caching/example.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
=======
2+
Caching
3+
=======
4+
5+
This example shows how to use caching. This can be useful
6+
for big projects where you don't want the c++ to be parsed
7+
again and again.
8+
9+
Let's consider the following c++ file:
10+
11+
.. literalinclude:: example.hpp
12+
:language: c++
13+
14+
To enable caching, you can use the following code:
15+
16+
.. literalinclude:: example.py
17+
:language: python
18+
19+
The first time you run this example, the c++ file will be read and a xml
20+
file will be generated:
21+
22+
INFO Creating xml file "example.hpp.xml" from source file "example.hpp" ...
23+
INFO Parsing xml file "example.hpp.xml" ...
24+
My name is: ns
25+
26+
The second time you run the example the xml file will not be regenerated:
27+
28+
INFO Parsing xml file "example.hpp.xml" ...
29+
My name is: ns
30+
31+
Of course the performance gain will be small for this example,
32+
but can be intersting for bigger projects.

0 commit comments

Comments
 (0)