Repository: ckan/ckan

Issue:
Installation instructions for 2.7.4 actually install 2.7.3
### CKAN Version if known (or site URL)
2.7.4

### Please describe the expected behaviour
The installation instructions for CKAN version 2.7.4 mentions and installs CKAN version 2.7.4

### Please describe the actual behaviour
Following the 'Install CKAN from source' instructions the documentation still states that 2.7.3 is the latest stable version and the terminal command downloads CKAN 2.7.3 (http://docs.ckan.org/en/2.7/maintaining/installing/install-from-source.html#install-ckan-into-a-python-virtual-environment Step C).

The chapter 'Installing CKAN from package' correctly reference the 2.7.4 release.

### What steps can be taken to reproduce the issue? 

Follow the installation instructions via http://docs.ckan.org/en/2.7/maintaining/installing/install-from-source.html#install-ckan-into-a-python-virtual-environment



Discussion:
Ups, thanks for flagging @WterBerg , we'll fix this asap
Something changed and all versions of the installation instructions now point to the latest stable ( 2.8.0 ). Is this intentional? I would expect the instructions for CKAN 2.6.6 to install CKAN 2.6.6.
No, @WterBerg this is not working as expected, there is a problem with the variables being used in the docs. As you say they should display the latest patch release for that minor version (ie 2.6.6). We need to fix this.
@tino097 can you add this to your list? one of the variables set in `doc/conf.py` probably needs to be cahnged to use the branch that the docs are on rather than the latest one.

Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -183,10 +183,26 @@ def get_status_of_this_version():
         return 'unsupported'
 
 
+def get_current_release_tag():
+    ''' Return the name of the tag for the current release
+
+    e.g.: "ckan-2.7.4"
+
+    '''
+    release_tags_ = get_release_tags()
+
+    current_tag = "ckan-{}".format(version)
+
+    if release_tags_.__contains__(current_tag):
+        return current_tag
+    else:
+        return 'COULD_NOT_DETECT_TAG_VERSION'
+
+
 def get_latest_release_tag():
     '''Return the name of the git tag for the latest stable release.
 
-    e.g.: "ckan-2.1.1"
+    e.g.: "ckan-2.7.4"
 
     This requires git to be installed.
 
@@ -212,6 +228,19 @@ def get_latest_release_version():
     return version
 
 
+def get_current_release_version():
+    '''Return the version number of the current release.
+
+    e.g. "2.1.1"
+
+    '''
+    version = get_current_release_tag()[len('ckan-'):]
+
+    # TODO: We could assert here that latest_version matches X.Y.Z.
+
+    return version
+
+
 def get_latest_package_name(distro='trusty'):
     '''Return the filename of the Ubuntu package for the latest stable release.
 
@@ -266,7 +295,8 @@ def write_substitutions_file(**kwargs):
             f.write('.. |{name}| replace:: {substitution}\n'.format(
                     name=name, substitution=substitution))
 
-
+current_release_tag = get_current_release_tag()
+current_release_version = get_current_release_version()
 latest_release_tag_value = get_latest_release_tag()
 latest_release_version = get_latest_release_version()
 latest_minor_version = latest_release_version[:3]
@@ -276,7 +306,7 @@ def write_substitutions_file(**kwargs):
 
 write_substitutions_file(
     latest_release_tag=latest_release_tag_value,
-    latest_release_version=get_latest_release_version(),
+    latest_release_version=latest_release_version,
     latest_package_name_precise=get_latest_package_name('precise'),
     latest_package_name_trusty=get_latest_package_name('trusty'),
     latest_package_name_xenial=get_latest_package_name('xenial'),


Test patch: