Initial commit

This commit is contained in:
resteve 2016-01-11 22:57:21 +01:00
commit b4d85f2700
7 changed files with 234 additions and 0 deletions

1
CHANGELOG Normal file
View File

@ -0,0 +1 @@

14
COPYRIGHT Normal file
View File

@ -0,0 +1,14 @@
Copyright (C) 2016 TrytonSpain
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

29
INSTALL Normal file
View File

@ -0,0 +1,29 @@
Installing trytontasks-sao
==========================
Prerequisites
-------------
* Python 2.7 or later (http://www.python.org/)
* invoke (https://pypi.python.org/pypi/invoke/)
* sphinx
* sphinxcontrib-inheritance
* trydoc
Installation
------------
Once you've downloaded and unpacked the trytond_esale source release, enter the
directory where the archive was unpacked, and run:
python setup.py install
Note that you may need administrator/root privileges for this step, as
this command will by default attempt to install module to the Python
site-packages directory on your system.
For advanced options, please refer to the easy_install and/or the distutils
documentation:
http://peak.telecommunity.com/DevCenter/EasyInstall
http://docs.python.org/inst/inst.html

40
README Normal file
View File

@ -0,0 +1,40 @@
Tryton Tasks User DOC
=====================
Generate Tryton User DOC
Installing
----------
See INSTALL
Support
-------
For more information or if you encounter any problems with this module,
please contact the programmers at
TrytonSpain
-----------
website: http://www.tryton-erp.es/
project: https://bitbucket.org/trytonspain/
If you encounter any problems with Tryton, please don't hesitate to ask
questions on the Tryton bug tracker, mailing list, wiki or IRC channel:
https://bitbucket.org/trytonspain/
License
-------
See LICENSE
Copyright
---------
See COPYRIGHT
For more information please visit the Tryton web site:
http://www.tryton-erp.es/

44
setup.py Normal file
View File

@ -0,0 +1,44 @@
#!/usr/bin/env python
#This file is part of trytontasks_userdoc. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
from setuptools import setup, find_packages
import os
execfile(os.path.join('trytontasks_userdoc', 'version.py'))
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name=PACKAGE,
version=VERSION,
description='Tryton Tasks User DOC',
long_description=read('README'),
author=AUTHOR,
url=WEBSITE,
download_url="https://bitbucket.org/trytonspain/trytontasks-modules",
packages=find_packages(),
package_data={},
scripts=[],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: No Input/Output (Daemon)',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Software Development :: Libraries',
],
license=LICENSE,
install_requires=[
'invoke>=0.11.1',
'blessings',
'sphinx',
'sphinxcontrib-inheritance',
'trydoc',
],
extras_require={},
zip_safe=False,
#~ test_suite='trytontasks_userdoc.tests',
)

View File

@ -0,0 +1,98 @@
#This file is part of trytontasks_userdoc. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
import os
import glob
from invoke import task, run
from blessings import Terminal
from path import path
from string import Template
t = Terminal()
def create_symlinks(origin, destination, lang='es', remove=True):
if remove:
# Removing existing symlinks
for link_file in path(destination).listdir():
if link_file.islink():
link_file.remove()
for module_doc_dir in glob.glob('%s/*/doc/%s' % (origin, lang)):
module_name = str(path(module_doc_dir).parent.parent.basename())
symlink = path(destination).joinpath(module_name)
if not symlink.exists():
path(destination).relpathto(path(module_doc_dir)).symlink(symlink)
def make_link(origin, destination):
directory = os.path.dirname(destination)
if not os.path.exists(destination):
path(directory).relpathto(path(origin)).symlink(destination)
@task
def install():
'Install User DOC'
run('pip install sphinx')
run('pip install sphinxcontrib-inheritance')
run('pip install trydoc --no-dependencies') # force not install proteus from pypi
#~ run('which sphinx-build')
run('hg clone https://bitbucket.org/trytonspain/trytond-doc')
print t.bold('Done')
@task
def make(modules='modules', user_doc_path='trytond-doc',
source_doc='doc-src', doc_path="doc", lang="es", project_name=None,
version=None, copyright=None):
'Make User DOC'
if not os.path.exists(modules):
print t.bold('Not found modules dir')
exit()
if not os.path.exists(user_doc_path):
print t.bold('Clone https://bitbucket.org/trytonspain/trytond-doc')
exit()
if not os.path.exists(source_doc):
run("mkdir %(source_doc)s" % locals())
if not os.path.exists(doc_path):
run("mkdir %(doc_path)s" % locals())
# create symlinks from modules.
create_symlinks(modules, source_doc, lang, True)
# create symlinks from core modeules.
create_symlinks(user_doc_path, source_doc, lang, False)
conf_file = '%s/conf.py' % source_doc
if not os.path.exists(conf_file):
template = '%s/conf.py.template' % user_doc_path
with open(template, 'r') as f:
tpl_config = f.read()
vals = {
'PROJECT': project_name or 'Tryton Doc',
'COPYRIGHT': copyright or 'Tryton ERP',
'VERSION': version or '3.8',
}
tpl = Template(tpl_config).substitute(vals)
with open(conf_file, 'w') as f:
f.write(tpl)
# create symlink for index
index = os.path.join(user_doc_path, 'index.rst')
link = os.path.join(source_doc, 'index.rst')
make_link(index, link)
print t.bold('Done')
@task
def build(source_doc='doc-src', doc_path="doc", buildername='html'):
'Build User DOC (html, singlehtml...)'
dbname = os.environ.get('DB_NAME')
if not dbname:
print t.red('Select a database name:')
print t.green('export DB_NAME=databasename')
exit()
print 'Database: ' + t.bold(dbname)
# Sphinx Build options: http://www.sphinx-doc.org/en/stable/invocation.html
cmd = 'sphinx-build -b %s %s %s' % (buildername, source_doc, doc_path)
run(cmd)
print t.bold('Done')

View File

@ -0,0 +1,8 @@
#This file is part of trytontasks_userdoc. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
PACKAGE = 'trytontasks_userdoc'
VERSION = '0.0.1'
LICENSE = 'GPL-3'
WEBSITE = 'http://www.tryton-erp.es/'
AUTHOR = 'TrytonSpain'