Skip to content

Commit

Permalink
remove automatic git clone and use submodules, see #25
Browse files Browse the repository at this point in the history
  • Loading branch information
k-okada committed Jul 25, 2019
1 parent 852b6cf commit cb9ea3e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 185 deletions.
30 changes: 0 additions & 30 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1 @@
*.py[cdo]
venv

_build
_static

index.rst

# Euslisp repos
jskeus

# jsk-ros-pkg repos
jsk_common
jsk_control
jsk_demos
jsk_planning
jsk_recognition
jsk_robot
jsk_roseus
jsk_smart_apps
jsk_travis
jsk_visualization

# start-jsk repos
hrpsys-base
rtmros_choreonoid
rtmros_common
rtmros_gazebo
rtmros_hironx
rtmros_tutorials
jsk_apc
97 changes: 0 additions & 97 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,103 +86,6 @@
"""

## get repositories and auto gen readme doc
try:
filename = 'doc.rosinstall'
stream = open(filename, 'r')
repos = yaml.load(stream)
except:
print >>sys.stderr, "Unexpected error:", sys.exc_info()[0]
sys.exit(1)
with open("index.rst", "w") as f:
f.write(index_text.format(local_name="jsk_docs", uri="https://github.com/jsk-ros-pkg/jsk_docs"))
for repo in repos:
# setup repo
local_name = repo['git']['local-name']
uri = os.path.splitext(repo['git']['uri'])[0]
version = repo['git']['version'] if repo['git'].has_key('version') else 'master'
print("wrokin on name:{} uri:{} branch:{}".format(local_name, uri, version))
if os.path.exists(local_name):
subprocess.call(['git', 'fetch', '--all'], cwd=local_name)
else:
subprocess.call(['git', 'clone', '--depth=1', uri, local_name, '-b', version])
subprocess.call(['git', 'clean', '-xfd'], cwd=local_name)
subprocess.call(['git', 'reset', '--hard', 'origin/%s' % version], cwd=local_name)

if "/" not in local_name:
with open("index.rst", "a") as f:
f.write(" %s/doc/index\n"%(local_name))
# add index.rst if not exists
index = os.path.join(local_name, "doc", "index.rst")
if not os.path.exists(index):
print("Add %s"%(index))
if not os.path.exists(os.path.dirname(index)):
os.mkdir(os.path.dirname(index))
with open(index, "a") as f:
f.write(index_text.format(local_name=local_name, uri=uri))

# for each README.md
for root, dirs, files in os.walk(local_name):
for file in files:
if file.endswith("README.md") and not root.startswith(os.path.join(local_name, "doc")):
symlink_dir = os.path.join(local_name, "doc", root[len(local_name)+1:]) # repo/doc/pkg, not repo/doc/repo/pkg
symlink_file = os.path.join(symlink_dir, file)
target_file = os.path.join(root, file)
print "-",target_file, symlink_file, root
if os.path.exists(symlink_dir):
print("Skipping %s, which is already existing"%(symlink_dir))
elif root == local_name and os.path.exists(target_file) and not os.path.exists(symlink_file):
print ("Creating symlink for %s"%symlink_file)
os.symlink(os.path.relpath(os.path.join(target_file),os.path.dirname(symlink_file)), symlink_file)
with open(index, "a") as f:
f.write(" %s\n"%("README.md"))
else:
# copy directory
shutil.copytree(root, symlink_dir)
print ("Copying directries %s"%symlink_file)
with open(index, "a") as f:
f.write(" %s\n"%(os.path.join(root[len(local_name)+1:],file)))

# hrpsys
if local_name == "hrpsys-base":
build_dir = os.path.join('_build', 'html', 'hrpsys-base-api')
if not os.path.exists(build_dir):
os.mkdir(build_dir)
if not os.path.exists(build_dir):
os.makedirs(os.path.dirname(build_dir))
shutil.copytree('hrpsys', build_dir)
with open(index, "a") as f:
f.write("\n")
f.write("`API Documents <../../hrpsys-base-api/html>`_\n")

# euslisp
if local_name == "jskeus":
doc_dir=os.path.join('jskeus', 'doc');
build_dir = os.path.join('_build', 'html', 'jskeus', 'doc', 'html')
if not os.path.exists(build_dir):
os.makedirs(os.path.dirname(build_dir))
shutil.copytree('jskeus', build_dir)
with open(index, "a") as f:
f.write("\n")
f.write("`API Documents <html>`_\n")

# Add image tables in index page for nodes
this_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, this_dir)
import add_img_tables_to_index
if (not on_rtd) and subprocess.check_output(['git', 'diff']):
print('skipping adding image tables because there is changes in VCS')
else:
cwd = os.path.abspath(os.getcwd())
for repo in os.listdir(this_dir):
doc = os.path.join(cwd, repo, 'doc')
if not os.path.exists(doc):
continue
print("adding image table for '{doc}'".format(doc=doc))
os.chdir(doc)
add_img_tables_to_index.main(exclude_patterns)
os.chdir(cwd)

# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
Expand Down
58 changes: 0 additions & 58 deletions doc/doc.rosinstall

This file was deleted.

67 changes: 67 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

==========
jsk_docs
==========

jsk_docs is common stacks used in JSK lab.

.. raw:: html

<h2>
Search docs!
</h2>


.. raw:: html

<script>
(function() {
var cx = '004597581434396922146:u8zamng695e';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>

.. raw:: html

<h2>
<a href="https://github.com/jsk-ros-pkg/jsk_docs/issues">Ask question!</a>
</h2>

The code is open source, and `available on github`_.

.. _available on github: https://github.com/jsk-ros-pkg/jsk_docs
.. _github issue: https://github.com/jsk-ros-pkg/jsk_docs/issues

:doc:`inverse_lookup` should be useful for you

This repository contains following ros packages:


.. toctree::
:maxdepth: 2

jskeus/doc/index
jsk_common/doc/index
jsk_roseus/doc/index
jsk_recognition/doc/index
jsk_visualization/doc/index
jsk_planning/doc/index
jsk_control/doc/index
jsk_smart_apps/doc/index
jsk_travis/doc/index
jsk_robot/doc/index
jsk_demos/doc/index
hrpsys-base/doc/index
rtmros_common/doc/index
rtmros_tutorials/doc/index
rtmros_choreonoid/doc/index
rtmros_gazebo/doc/index
rtmros_hironx/doc/index
jsk_apc/doc/index

0 comments on commit cb9ea3e

Please sign in to comment.