From: Marvin Liu <yong.liu@intel.com>
To: dts@dpdk.org
Cc: Marvin Liu <yong.liu@intel.com>
Subject: [dts] [PATCH] dts: add version file and enable it in doc conf.py
Date: Tue, 29 Aug 2017 11:06:51 -0400 [thread overview]
Message-ID: <1504019211-58188-1-git-send-email-yong.liu@intel.com> (raw)
When Sphinx building doc, version of DTS can be stripped from source
code and inserted to html header.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/doc/dts_gsg/conf.py b/doc/dts_gsg/conf.py
index 568150e..fa5f0e4 100644
--- a/doc/dts_gsg/conf.py
+++ b/doc/dts_gsg/conf.py
@@ -27,6 +27,7 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import subprocess
try:
import sphinx_rtd_theme
@@ -38,4 +39,10 @@ except:
project = 'DPDK Test Suite'
copyright = '2017, dpdk.org'
+
+strip_version_cmd = 'import sys;sys.path.append(\'../..\');import version; print version.dts_version()'
+version = subprocess.check_output(['python', '-c', strip_version_cmd])
+version = version.decode('utf-8').rstrip()
+release = version
+
master_doc = 'index'
diff --git a/version.py b/version.py
new file mode 100755
index 0000000..f657133
--- /dev/null
+++ b/version.py
@@ -0,0 +1,19 @@
+# <COPYRIGHT_TAG>
+
+VERSION_MAJOR = "17"
+VERSION_MINOR = "08"
+VERSION_PATCH = "0"
+VERSION_EXTRA = ""
+
+__version__ = '%s.%s.%s' % (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
+
+if VERSION_EXTRA:
+ __version__ = "%s-%s" % (__version__, VERSION_EXTRA)
+
+def dts_version():
+ """
+ Return the version of dts package
+ """
+ return __version__
+
+__all__ = ['dts_version', '__version__']
--
1.9.3
reply other threads:[~2017-08-29 15:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1504019211-58188-1-git-send-email-yong.liu@intel.com \
--to=yong.liu@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).