From dd9774fb6d55f62ef830c098bb28c725bcc58cb2 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Tue, 23 May 2017 11:28:28 -0700 Subject: [PATCH 1/4] Remove the documentation's dependency on Hy itself --- docs/conf.py | 13 +++++++------ get_version.py | 20 ++++++++++++++++++++ setup.py | 21 +++------------------ 3 files changed, 30 insertions(+), 24 deletions(-) create mode 100644 get_version.py diff --git a/docs/conf.py b/docs/conf.py index 8b8d339..bf120a0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,12 +11,13 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import os -import sys -import time +import os, sys, time sys.path.append(os.path.abspath("..")) -import hy +from get_version import __version__ as hy_version +if hy_version.endswith(".dirty"): + # Read the Docs might dirty its checkout, so ignore this. + hy_version = hy_version[:-len(".dirty")] # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -53,9 +54,9 @@ copyright = u'%s the authors' % time.strftime('%Y') # built documents. # # The short X.Y version. -version = ".".join(hy.__version__.split(".")[:-1]) +version = ".".join(hy_version.split(".")[:-1]) # The full version, including alpha/beta/rc tags. -release = hy.__version__ +release = hy_version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/get_version.py b/get_version.py new file mode 100644 index 0000000..759336d --- /dev/null +++ b/get_version.py @@ -0,0 +1,20 @@ +import os, subprocess, runpy + +# Try to get and update the version. + +os.chdir(os.path.split(os.path.abspath(__file__))[0]) +VERSIONFILE = os.path.join("hy", "version.py") + +try: + __version__ = (subprocess.check_output + (["git", "describe", "--tags", "--dirty"]) + .decode('ASCII').strip() + .replace('-', '+', 1).replace('-', '.')) + with open(VERSIONFILE, "wt") as o: + o.write("__version__ = {!r}\n".format(__version__)) + +except (subprocess.CalledProcessError, OSError): + if os.path.exists(VERSIONFILE): + __version__ = runpy.run_path(VERSIONFILE)['__version__'] + else: + __version__ = "unknown" diff --git a/setup.py b/setup.py index a7d551b..a5d64a9 100755 --- a/setup.py +++ b/setup.py @@ -3,31 +3,16 @@ # This file is part of Hy, which is free software licensed under the Expat # license. See the LICENSE. -import os -import re -import sys -import runpy -import subprocess +import sys, os from setuptools import find_packages, setup from setuptools.command.install import install +from get_version import __version__ + os.chdir(os.path.split(os.path.abspath(__file__))[0]) PKG = "hy" -VERSIONFILE = os.path.join(PKG, "version.py") -try: - __version__ = (subprocess.check_output - (["git", "describe", "--tags", "--dirty"]) - .decode('ASCII').strip() - .replace('-', '+', 1).replace('-', '.')) - with open(VERSIONFILE, "wt") as o: - o.write("__version__ = {!r}\n".format(__version__)) -except (subprocess.CalledProcessError, OSError): - if os.path.exists(VERSIONFILE): - __version__ = runpy.run_path(VERSIONFILE)['__version__'] - else: - __version__ = "unknown" long_description = """Hy is a Python <--> Lisp layer. It helps make things work nicer, and lets Python and the Hy lisp variant play From e15992829db1b132cb3a0abf8b01e3c02fcd6c2f Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Mon, 15 May 2017 17:16:17 -0400 Subject: [PATCH 2/4] Simplify docs/conf.py --- docs/conf.py | 225 +----------------------------------- docs/language/internals.rst | 3 +- 2 files changed, 6 insertions(+), 222 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index bf120a0..9ba78f6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,15 +1,6 @@ # -*- coding: utf-8 -*- # -# hy documentation build configuration file, created by -# sphinx-quickstart on Tue Mar 12 22:52:58 2013. -# # This file is execfile()d with the current directory set to its containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. import os, sys, time sys.path.append(os.path.abspath("..")) @@ -19,30 +10,9 @@ if hy_version.endswith(".dirty"): # Read the Docs might dirty its checkout, so ignore this. hy_version = hy_version[:-len(".dirty")] -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) - -# -- General configuration ----------------------------------------------------- - -# If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.todo'] - -# Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] - -# The suffix of source filenames. source_suffix = '.rst' -# The encoding of source files. -#source_encoding = 'utf-8-sig' - -# The master toctree document. master_doc = 'index' # General information about the project. @@ -58,203 +28,18 @@ version = ".".join(hy_version.split(".")[:-1]) # The full version, including alpha/beta/rc tags. release = hy_version -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -#language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. exclude_patterns = ['_build', 'coreteam.rst'] -# The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' -# A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] - - -# -- Options for HTML output --------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -try: - import sphinx_rtd_theme -except ImportError: - html_theme = 'default' -else: - html_theme = 'sphinx_rtd_theme' - html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] - -# 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 -# documentation. -#html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -#html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -#html_favicon = None +import sphinx_rtd_theme +html_theme = 'sphinx_rtd_theme' +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -#html_domain_indices = True - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -#html_split_index = False - -# If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None - -# Output file base name for HTML help builder. -htmlhelp_basename = 'hydoc' - - -# -- Options for LaTeX output -------------------------------------------------- - -latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', - -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', - -# Additional stuff for the LaTeX preamble. -#'preamble': '', - -# Stuff for unicode characters - 'utf8extra': r''' -\DeclareUnicodeCharacter{2698}{FLOWER} -\DeclareUnicodeCharacter{2665}{HEART} -''', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). -latex_documents = [ - ('index', 'hy.tex', u'hy Documentation', - u'Paul Tagliamonte', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# If true, show page references after internal links. -#latex_show_pagerefs = False - -# If true, show URL addresses after external links. -#latex_show_urls = False - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_domain_indices = True - - -# -- Options for manual page output -------------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'hy', u'hy Documentation', - [u'Paul Tagliamonte'], 1) -] - -# If true, show URL addresses after external links. -#man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------------ - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ('index', 'hy', u'hy Documentation', - u'Paul Tagliamonte', 'hy', 'One line description of project.', - 'Miscellaneous'), -] - -# Documents to append as an appendix to all manuals. -#texinfo_appendices = [] - -# If false, no module index is generated. -#texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' +html_use_smartypants = False +html_show_sphinx = False diff --git a/docs/language/internals.rst b/docs/language/internals.rst index fec5e3b..bf2f4f0 100644 --- a/docs/language/internals.rst +++ b/docs/language/internals.rst @@ -460,5 +460,4 @@ Checking Macro Arguments and Raising Exceptions Hy Compiler Built-Ins ===================== -.. todo:: - Write this. +.. TODO: Write this. From 479c1755a9030f816fb4d57ecb6c8e330e3ea44c Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Tue, 23 May 2017 11:29:48 -0700 Subject: [PATCH 3/4] Show a version number at the top of each docs page --- docs/_templates/breadcrumbs.html | 5 +++++ docs/conf.py | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 docs/_templates/breadcrumbs.html diff --git a/docs/_templates/breadcrumbs.html b/docs/_templates/breadcrumbs.html new file mode 100644 index 0000000..0c05fea --- /dev/null +++ b/docs/_templates/breadcrumbs.html @@ -0,0 +1,5 @@ +{% extends "!breadcrumbs.html" %} +{% block breadcrumbs_aside %} +
  • Hy version {{ hy_descriptive_version }}
  • + {{ super() }} +{% endblock %} diff --git a/docs/conf.py b/docs/conf.py index 9ba78f6..3a9c66c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,7 +2,7 @@ # # This file is execfile()d with the current directory set to its containing dir. -import os, sys, time +import os, sys, time, cgi sys.path.append(os.path.abspath("..")) from get_version import __version__ as hy_version @@ -27,6 +27,9 @@ copyright = u'%s the authors' % time.strftime('%Y') version = ".".join(hy_version.split(".")[:-1]) # The full version, including alpha/beta/rc tags. release = hy_version +hy_descriptive_version = cgi.escape(hy_version) +if "+" in hy_version: + hy_descriptive_version += " (unstable)" exclude_patterns = ['_build', 'coreteam.rst'] @@ -43,3 +46,6 @@ html_static_path = ['_static'] html_use_smartypants = False html_show_sphinx = False + +html_context = dict( + hy_descriptive_version = hy_descriptive_version) From 584273b9cab6bd0518b78c5b922bc14dcb3cdbc1 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Wed, 24 May 2017 09:46:11 -0700 Subject: [PATCH 4/4] Update documentation links Fixes #1299. --- CONTRIBUTING.rst | 6 +++--- README.md | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 1659375..8c154a6 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -14,7 +14,7 @@ Pull requests are great! We love them; here is a quick guide: - Before contributing make sure you check the docs. There are two versions of docs available: - + `latest`_, for use with the bleeding-edge GitHub version. + + `master`_, for use with the bleeding-edge GitHub version. + `stable`_, for use with the PyPI version. @@ -118,6 +118,6 @@ http://contributor-covenant.org/version/1/1/0/. .. _Fork the Repo: https://help.github.com/articles/fork-a-repo/ .. _Start Here: http://rogerdudler.github.io/git-guide/ .. _good-first-bug: https://github.com/hylang/hy/issues?q=is%3Aissue+is%3Aopen+label%3Agood-first-bug -.. _latest: http://hylang.org/ -.. _stable: http://docs.hylang.org/en/stable/ +.. _master: http://docs.hylang.org/en/master/ +.. _stable: http://hylang.org/ diff --git a/README.md b/README.md index a487982..1a62174 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,10 @@ Project ------- * Code: https://github.com/hylang/hy -* Docs (latest, for use with bleeding-edge github version): http://hylang.org/ -* Docs (stable, for use with the PyPI version): http://docs.hylang.org/en/stable/ -* Quickstart: http://hylang.org/en/latest/quickstart.html +* Documentation: + * stable, for use with the latest stable release: http://hylang.org/ + * master, for use with the latest revision on GitHub: http://docs.hylang.org/en/master +* Quickstart: http://hylang.org/en/stable/quickstart.html * Bug reports: We have no bugs! Your bugs are your own! (https://github.com/hylang/hy/issues) * License: MIT (Expat) * [Contributor Guidelines & Code of Conduct](https://github.com/hylang/hy/blob/master/CONTRIBUTING.rst)