Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mgallet
committed
Apr 1, 2016
1 parent
6c1d17d
commit 00f4f4e
Showing
12 changed files
with
126 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Created by .gitignore support plugin (hsz.mobi) | ||
### Python template | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# Standard IDEs | ||
.idea/ | ||
.project/ | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
|
||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
recursive-include sphinxfolders * | ||
exclude .git .svn | ||
include LICENSE README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,133 +1,39 @@ | ||
#!/usr/bin/env python | ||
#coding=utf-8 | ||
# coding=utf-8 | ||
from __future__ import unicode_literals | ||
|
||
import codecs | ||
import datetime | ||
from distutils import log | ||
from distutils.core import setup | ||
import getpass | ||
import glob | ||
import imp | ||
import os | ||
import os.path | ||
import re | ||
import sys | ||
|
||
module_name = 'sphinxfolders' | ||
if module_name == '{' + '{ package_name }' + '}': | ||
module_name = 'starterpyth' | ||
|
||
command = len(sys.argv) > 1 and sys.argv[1] or None | ||
build_path = os.path.join(os.path.dirname(__file__), 'build') | ||
|
||
(file_, pathname, description) = imp.find_module(module_name) | ||
main_module = imp.load_module(module_name, file_, pathname, description) | ||
|
||
__version__ = getattr(main_module, '__version__', u'1.0') | ||
__author__ = getattr(main_module, '__author__', getpass.getuser()) | ||
__maintainer__ = getattr(main_module, '__maintainer__', getpass.getuser()) | ||
__email__ = getattr(main_module, '__email__', u'%s@example.com' % getpass.getuser()) | ||
__maintainer_email__ = getattr(main_module, '__email__', u'%s@example.com' % __maintainer__) | ||
__copyright__ = getattr(main_module, '__copyright__', u'Copyright %d' % datetime.date.today().year) | ||
__credits__ = getattr(main_module, '__credits__', []) | ||
__licence__ = getattr(main_module, '__licence__', u'Cecill-B') | ||
__description__ = getattr(main_module, '__description__', u'Sample Python application') | ||
__url__ = getattr(main_module, '__url__', u'http://www.example.com/%s/' % module_name) | ||
__include_paths__ = getattr(main_module, '__include_paths__', []) | ||
|
||
|
||
def find_packages(name, main_module): | ||
source = os.path.abspath(os.path.dirname(main_module.__file__)) | ||
l = len(source) | ||
result = [str(name), ] | ||
for root, dirs, files in os.walk(source): | ||
for mod_name in dirs: | ||
s = '%s.%s' % (name, os.path.join(root, mod_name)[l+1:].replace(os.path.sep, '.')) | ||
file_ = None | ||
try: | ||
(file_, pathname, description) = imp.find_module(mod_name, [root, ]) | ||
imp.load_module(s, file_, pathname, description) | ||
file_ = None | ||
result.append(s) | ||
except: | ||
file_.close() if file_ else 0 | ||
return result | ||
|
||
def find_data_files(sources, exclude_regexp): | ||
u'''Helper function to generate list of extra files for py2exe''' | ||
lis = [] | ||
ret = {} | ||
r = re.compile(exclude_regexp) | ||
for source in sources: | ||
source = os.path.join(os.path.abspath(os.path.dirname(main_module.__file__)), source) | ||
target = os.path.basename(source) | ||
for root, dirs, files in os.walk(source): | ||
for k in files: | ||
pathname = os.path.join(root, k) | ||
if r.match(pathname): | ||
continue | ||
targetpath = os.path.join(target, os.path.relpath(pathname, source)) | ||
path = os.path.dirname(targetpath) | ||
ret.setdefault(path, []).append(pathname) | ||
lis.append(os.path.join(target, os.path.relpath(pathname, source))) | ||
return (lis, sorted(ret.items())) | ||
|
||
data_files, exe_data_files = find_data_files(__include_paths__, '.*(.svn).*') | ||
|
||
|
||
# try to include some extra commands | ||
try: import py2app | ||
except: pass | ||
try: import py2exe | ||
except: pass | ||
cmdclass = {} | ||
try: | ||
import starterpyth.command.gen_doc | ||
import starterpyth.command.gen_doc_api | ||
import starterpyth.command.dependencies | ||
import starterpyth.command.lint | ||
import starterpyth.command.dmg | ||
import starterpyth.command.test_doc | ||
import starterpyth.command.compilemessages | ||
import starterpyth.command.makemessages | ||
cmdclass.update({ | ||
'gen_doc': starterpyth.command.gen_doc.gen_doc, | ||
'gen_doc_api': starterpyth.command.gen_doc_api.gen_doc_api, | ||
'dependencies': starterpyth.command.dependencies.dependencies, | ||
'lint': starterpyth.command.lint.lint, | ||
'dmg': starterpyth.command.dmg.dmg, | ||
'test_doc': starterpyth.command.test_doc.test_doc, | ||
'makemessages': starterpyth.command.makemessages.makemessages, | ||
'compilemessages': starterpyth.command.compilemessages.compilemessages, | ||
}) | ||
except: | ||
pass | ||
|
||
|
||
packages = find_packages(module_name, main_module) | ||
extra_options = { | ||
'name': module_name, | ||
'version': __version__, | ||
'author': __author__, | ||
'author_email': __email__, | ||
'maintainer': __maintainer__, | ||
'maintainer_email': __maintainer_email__, | ||
'description': __description__, | ||
'license': __licence__, | ||
'long_description': codecs.open(os.path.join(os.path.dirname(__file__), 'README.txt'), 'r', encoding='utf-8').read(), | ||
'url': __url__, | ||
'packages': packages, | ||
'platforms': ['all'], | ||
'package_data': {module_name: data_files, }, | ||
'cmdclass': cmdclass, | ||
'provides': packages, | ||
'test_suite': '%s.load_tests' % module_name, | ||
} | ||
if command == 'py2exe': | ||
extra_options['setup_requires'] = ['py2exe', ] | ||
|
||
for k, v in extra_options.items(): | ||
if isinstance(v, unicode): | ||
extra_options[k] = v.encode('utf-8') | ||
|
||
extra_options['install_requires'] = [] # please add here a list of required Python modules | ||
setup(requires=['sphinx', 'docutils'], **extra_options) | ||
from setuptools import setup, find_packages | ||
|
||
|
||
# avoid a from penatesimport __version__ as version | ||
# (that compiles penates.__init__ and is not compatible with bdist_deb) | ||
version = None | ||
for line in codecs.open(os.path.join('sphinxfolders', '__init__.py'), 'r', encoding='utf-8'): | ||
matcher = re.match(r"""^__version__\s*=\s*['"](.*)['"]\s*$""", line) | ||
version = version or matcher and matcher.group(1) | ||
|
||
# get README content from README.md file | ||
with codecs.open(os.path.join(os.path.dirname(__file__), 'README.md'), encoding='utf-8') as fd: | ||
long_description = fd.read() | ||
|
||
setup( | ||
name='sphinxfolders', | ||
version=version, | ||
description='Sphinx directive to list the content of a folder', | ||
long_description=long_description, | ||
author='Matthieu Gallet', | ||
author_email='github@19pouces.net', | ||
license='CeCILL-B', | ||
url='https://github.com/d9pouces/SphinxFolders/', | ||
entry_points={}, | ||
packages=find_packages(), | ||
include_package_data=True, | ||
zip_safe=False, | ||
test_suite='penates.tests', | ||
install_requires=['sphinx', 'docutils'], | ||
setup_requires=[], | ||
classifiers=[], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
# coding=utf-8 | ||
"""Register all components of this extension""" | ||
|
||
|
||
from nodes import FolderNode | ||
from sphinxfolders.directives import FolderDirective | ||
from visitors import visit_folder_node, depart_folder_node | ||
|
||
__version__ = '1.0.2' | ||
|
||
|
||
def setup(app): | ||
#app.add_config_value('todo_include_todos', False, False) | ||
# app.add_config_value('todo_include_todos', False, False) | ||
|
||
#app.add_node(todolist) | ||
# app.add_node(todolist) | ||
app.add_node(FolderNode, html=(visit_folder_node, depart_folder_node)) | ||
app.add_directive('folder', FolderDirective) | ||
|
||
# app.add_directive('todolist', TodolistDirective) | ||
# app.connect('doctree-resolved', process_folder_nodes) | ||
# app.connect('env-purge-doc', purge_folders) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
__author__ = 'flanker' | ||
|
||
# coding=utf-8 | ||
from __future__ import unicode_literals | ||
from docutils import nodes | ||
__author__ = 'flanker' | ||
|
||
|
||
class FolderNode(nodes.General, nodes.Element): | ||
pass | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.