Remove the documentation's dependency on Hy itself

This commit is contained in:
Kodi Arfer 2017-05-23 11:28:28 -07:00
parent b9279183d7
commit dd9774fb6d
3 changed files with 30 additions and 24 deletions

View File

@ -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.

20
get_version.py Normal file
View File

@ -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"

View File

@ -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