Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
iMichka committed Nov 2, 2015
2 parents 6a765da + ef99db0 commit 8584d7d
Show file tree
Hide file tree
Showing 203 changed files with 4,172 additions and 21,738 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[run]
source = pygccxml,docs/example,unittests
parallel = True
append = .coverage

[report]
# Regexes for lines to exclude from consideration
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
*.pyc
*~
docs/_build
unittests/temp
unittests/data/pygccxml.cache
.idea
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,25 @@ python:
- "3.2"
- "3.3"
- "3.4"
- "3.5"

before_install:
# Install gccxml
- sudo apt-get update -qq
- sudo apt-get install -qq gccxml
# Install pep8, needed by the unit tests
- pip install pep8
# Install coverage tools
- pip install coverage
# Install coverage tools (On 3.2 the new coverage is broken, use an old one)
# https://github.com/menegazzo/travispy/issues/20
- if [ $TRAVIS_PYTHON_VERSION == 3.2 ];
then pip install 'coverage<4.0'; else
pip install coverage;
fi
- pip install coveralls

install:
- if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install unittest2; fi

script:
# Modify sitecustomize.py file for coverage. Allows to cover files run in a subprocess.
- touch "/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/lib/python${TRAVIS_PYTHON_VERSION}/sitecustomize.py"
Expand Down
22 changes: 0 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,12 @@ SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = docs/_build
GH_PAGES_SOURCES = docs pygccxml Makefile

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(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/)
endif

# Check if the spinx version is the right one. Sphinx does not allow to check for
# minor sphinx revisions in conf.py, so we have to do this check here.
# This is needed because it the doc is uploaded to the git pages, we don't want
# to merge in changes due to a sphinx version change.
ifeq ($(shell $(SPHINXBUILD) --version | grep -q "1.2.2" >/dev/null 2>&1; echo $$?), 1)
$(error You need sphinx 1.2.2 to build the documentation !)
endif

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
Expand Down Expand Up @@ -184,16 +175,3 @@ pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

gh-pages:
git checkout gh-pages
rm -rf docs/*
rm -rf documentation/*
git checkout master $(GH_PAGES_SOURCES)
git reset HEAD
make html
mv -fv docs/_build/html/* documentation
rm -rf $(GH_PAGES_SOURCES)
rm -rf documentation/_sources
git add -A
git commit -m "Generated gh-pages for `git log master -1 --pretty=short --abbrev-commit`"
20 changes: 14 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
pygccxml
========

.. image:: https://travis-ci.org/gccxml/pygccxml.svg?branch=master
.. image:: https://travis-ci.org/gccxml/pygccxml.svg?branch=develop
:target: https://travis-ci.org/gccxml/pygccxml
.. image:: https://coveralls.io/repos/gccxml/pygccxml/badge.png?branch=master
:target: https://coveralls.io/r/gccxml/pygccxml?branch=master

pygccxml is a specialized XML reader that reads the output from GCCXML. It provides a simple framework to navigate C++ declarations, using Python classes.
:alt: Unit tests status
.. image:: https://coveralls.io/repos/gccxml/pygccxml/badge.svg?branch=develop
:target: https://coveralls.io/r/gccxml/pygccxml?branch=develop
:alt: Code coverage status
.. image:: https://readthedocs.org/projects/pygccxml/badge/?version=develop
:target: https://readthedocs.org/projects/pygccxml/?badge=develop
:alt: Documentation status
.. image:: https://www.quantifiedcode.com/api/v1/project/117af14ef32a455fb7b3762e21083fb3/snapshot/origin:develop:HEAD/badge.svg
:target: https://www.quantifiedcode.com/app/project/117af14ef32a455fb7b3762e21083fb3?branch=origin%2Fdevelop&tab=basics
:alt: Code quality status

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.

Install
-------
Expand All @@ -22,7 +30,7 @@ To install from source, you can use the usual procedure:
Contact us
----------

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

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

Expand Down
6 changes: 3 additions & 3 deletions docs/apidocs/declarations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ class_declaration
:undoc-members:
:show-inheritance:

compilers
---------
xml_generators
--------------

.. automodule:: pygccxml.declarations.compilers
.. automodule:: pygccxml.declarations.xml_generators
:members:
:undoc-members:
:show-inheritance:
Expand Down
8 changes: 4 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@

# General information about the project.
project = u'pygccxml'
copyright = u'2014, Insight Software Consortium'
copyright = u'2014-2015, Insight Software Consortium'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.6'
version = 'v1.7.0'
# The full version, including alpha/beta/rc tags.
release = '1.6'
release = 'v1.7.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -100,7 +100,7 @@

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

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
28 changes: 28 additions & 0 deletions docs/credits.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Contributors
------------

Thanks to all the people that have contributed patches, bug reports and suggestions,
or supported this project:

* Roman Yakovenko (original author)
* Roman Yakovenko's wife - Yulia
* Michka Popoff
* Brad King
* Matt Mccormick
* Mark Moll
* Holger Frydrych
* John Pallister
* Matthias Baas
* Allen Bierbaum
* Georgiy Dernovoy
* Darren Garnier
* Gottfried Ganssauge
* Gaetan Lehmann
* Martin Preisler
* Miguel Lobo
* Jeremy Sanders
* Ben Schleimer
* Gustavo Carneiro
* Christopher Bruns
* Alejandro Dubrovsky
* Aron Xu
54 changes: 18 additions & 36 deletions docs/download.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,36 @@
Download & Install
==================

-------------------------
pygccxml on SourceForge
-------------------------
------------------
pygccxml on Github
------------------

pygccxml project is hosted on SourceForge. Using SourceForge services you
can:
The pygccxml project is hosted on Github. Using Github you can:

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

------------
Installation
------------

-----------------
Subversion access
-----------------
Note that you will need `GCC-XML`_ on your system, see section below.

http://sourceforge.net/svn/?group_id=118209
You can use pip to install pygccxml:

--------
Download
--------
pip install pygccxml

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

------------
Installation
------------
python setup.py install

-------
GCC-XML
-------
There are few different ways to install GCC-XML on your system:
There are few different ways to install `GCC-XML`_ on your system:

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

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

.. _`instructions` : http://gccxml.org/HTML/Install.html
pygccxml
--------
In command prompt or shell change current directory to be "pygccxml-X.Y.Z".
"X.Y.Z" is version of pygccxml. Type the following command:

| ``python setup.py install``
After this command complete, you should have installed pygccxml package.

------------
Dependencies
------------

* `GCC-XML`_

.. _`GCC-XML`: http://www.gccxml.org
2 changes: 1 addition & 1 deletion docs/example/example.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014 Insight Software Consortium.
// Copyright 2014-2015 Insight Software Consortium.
// Copyright 2004-2009 Roman Yakovenko.
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
Expand Down
22 changes: 12 additions & 10 deletions docs/example/example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2014 Insight Software Consortium.
# Copyright 2014-2015 Insight Software Consortium.
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
Expand All @@ -9,20 +9,22 @@
# Find out the file location within the sources tree
this_module_dir_path = os.path.abspath(
os.path.dirname(sys.modules[__name__].__file__))
# Find out gccxml location
gccxml_09_path = os.path.join(
this_module_dir_path, '..', '..', '..',
'gccxml_bin', 'v09', sys.platform, 'bin')
# Add pygccxml package to Python path
sys.path.append(os.path.join(this_module_dir_path, '..', '..'))


from pygccxml import parser
from pygccxml import declarations
from pygccxml import parser # nopep8
from pygccxml import declarations # nopep8
from pygccxml import utils # nopep8

# Configure GCC-XML parser
config = parser.gccxml_configuration_t(
gccxml_path=gccxml_09_path, compiler='gcc')
# Find out the xml generator (gccxml or castxml)
generator_path, generator_name = utils.find_xml_generator()

# Configure the xml generator
config = parser.xml_generator_configuration_t(
xml_generator_path=generator_path,
xml_generator=generator_name,
compiler="gcc")

# Parsing source file
decls = parser.parse([this_module_dir_path + '/example.hpp'], config)
Expand Down
13 changes: 13 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
========
Examples
========

First examples
--------------

.. toctree::
:maxdepth: 1

examples/parsing/example.rst
examples/variables/example.rst
examples/caching/example.rst
7 changes: 7 additions & 0 deletions docs/examples/caching/example.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2014-2015 Insight Software Consortium.
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt

namespace ns{
int a = 1;
}
32 changes: 32 additions & 0 deletions docs/examples/caching/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2014-2015 Insight Software Consortium.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt

from pygccxml import utils
from pygccxml import declarations
from pygccxml import parser

# Find out the c++ parser
generator_path, generator_name = utils.find_xml_generator()

# Configure the xml generator
xml_generator_config = parser.xml_generator_configuration_t(
xml_generator_path=generator_path,
xml_generator=generator_name)

# The c++ file we want to parse
filename = "example.hpp"

file_config = parser.file_configuration_t(
data=filename,
content_type=parser.CONTENT_TYPE.CACHED_SOURCE_FILE)

project_reader = parser.project_reader_t(xml_generator_config)
decls = project_reader.read_files(
[file_config],
compilation_mode=parser.COMPILATION_MODE.FILE_BY_FILE)

global_namespace = declarations.get_global_namespace(decls)

value = global_namespace.namespace("ns")
print("My name is: " + value.name)
32 changes: 32 additions & 0 deletions docs/examples/caching/example.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
=======
Caching
=======

This example shows how to use caching. This can be useful
for big projects where you don't want the c++ to be parsed
again and again.

Let's consider the following c++ file:

.. literalinclude:: example.hpp
:language: c++

To enable caching, you can use the following code:

.. literalinclude:: example.py
:language: python

The first time you run this example, the c++ file will be read and a xml
file will be generated:

INFO Creating xml file "example.hpp.xml" from source file "example.hpp" ...
INFO Parsing xml file "example.hpp.xml" ...
My name is: ns

The second time you run the example the xml file will not be regenerated:

INFO Parsing xml file "example.hpp.xml" ...
My name is: ns

Of course the performance gain will be small for this example,
but can be intersting for bigger projects.
Loading

0 comments on commit 8584d7d

Please sign in to comment.