)]}'
{"functions-common":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"b5dc3e737ba10fc6949b6077ba9ca443ec5e5f62","unresolved":false,"context_lines":[{"line_number":1900,"context_line":"# Return the current python as \"python\u003cmajor\u003e.\u003cminor\u003e\""},{"line_number":1901,"context_line":"function python_version {"},{"line_number":1902,"context_line":"    # Python 2 reports version on stderr, Python 3 on stdout"},{"line_number":1903,"context_line":"    local python_version\u003d$(python -V 2\u003e\u00261 |sed \u0027s/^.*[^0-9]\\([0-9]*\\.[0-9]*\\).[0-9].*$/\\1/\u0027)"},{"line_number":1904,"context_line":"    echo \"python${python_version}\""},{"line_number":1905,"context_line":"}"},{"line_number":1906,"context_line":""}],"source_content_type":"application/x-shellscript","patch_set":1,"id":"9a0c5dc1_5874329b","line":1903,"updated":"2015-05-12 14:15:51.000000000","message":"python -c \u0027import sys; print(str(sys.version_info.major) + \".\" + str(sys.version_info.minor))\u0027\n\nNo?","commit_id":"2c438160aba21e77e933e7b78bca546db6be5198"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"9462d4f8616ea40636c5ea0ec7e324d354c34374","unresolved":false,"context_lines":[{"line_number":1900,"context_line":"# Return the current python as \"python\u003cmajor\u003e.\u003cminor\u003e\""},{"line_number":1901,"context_line":"function python_version {"},{"line_number":1902,"context_line":"    # Python 2 reports version on stderr, Python 3 on stdout"},{"line_number":1903,"context_line":"    local python_version\u003d$(python -V 2\u003e\u00261 |sed \u0027s/^.*[^0-9]\\([0-9]*\\.[0-9]*\\).[0-9].*$/\\1/\u0027)"},{"line_number":1904,"context_line":"    echo \"python${python_version}\""},{"line_number":1905,"context_line":"}"},{"line_number":1906,"context_line":""}],"source_content_type":"application/x-shellscript","patch_set":1,"id":"9a0c5dc1_58a1d2a8","line":1903,"in_reply_to":"9a0c5dc1_5874329b","updated":"2015-05-12 14:23:04.000000000","message":"I had something very much like that at first but it seemed to go against the existing norms in devstack, commands and pipelines, so I switched it.","commit_id":"2c438160aba21e77e933e7b78bca546db6be5198"},{"author":{"_account_id":13252,"name":"Dr. Jens Harbott","display_name":"Jens Harbott (frickler)","email":"frickler@offenerstapel.de","username":"jrosenboom"},"change_message_id":"13d389145d5d7729fe5db9695def4c9a8c47c904","unresolved":false,"context_lines":[{"line_number":1900,"context_line":"# Return the current python as \"python\u003cmajor\u003e.\u003cminor\u003e\""},{"line_number":1901,"context_line":"function python_version {"},{"line_number":1902,"context_line":"    # Python 2 reports version on stderr, Python 3 on stdout"},{"line_number":1903,"context_line":"    local python_version\u003d$(python -V 2\u003e\u00261 |sed \u0027s/^.*[^0-9]\\([0-9]*\\.[0-9]*\\).[0-9].*$/\\1/\u0027)"},{"line_number":1904,"context_line":"    echo \"python${python_version}\""},{"line_number":1905,"context_line":"}"},{"line_number":1906,"context_line":""}],"source_content_type":"application/x-shellscript","patch_set":1,"id":"9a0c5dc1_d8b0228e","line":1903,"in_reply_to":"9a0c5dc1_58a1d2a8","updated":"2015-05-12 14:30:18.000000000","message":"The do-it-in-python version looks nicer indeed, I\u0027d vote that.","commit_id":"2c438160aba21e77e933e7b78bca546db6be5198"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"f4795e3d4da9d0b51e8645ec33c0ae5899b642a1","unresolved":false,"context_lines":[{"line_number":1899,"context_line":""},{"line_number":1900,"context_line":"# Return the current python as \"python\u003cmajor\u003e.\u003cminor\u003e\""},{"line_number":1901,"context_line":"function python_version {"},{"line_number":1902,"context_line":"    # Python 2 reports version on stderr, Python 3 on stdout"},{"line_number":1903,"context_line":"    local python_version\u003d$(python -c \u0027import sys; print(\"%s.%s\" % sys.version_info[0:2])\u0027)"},{"line_number":1904,"context_line":"    echo \"python${python_version}\""},{"line_number":1905,"context_line":"}"}],"source_content_type":"application/x-shellscript","patch_set":2,"id":"9a0c5dc1_233a6e37","line":1902,"updated":"2015-05-12 15:53:12.000000000","message":"This looks like it\u0027s not true anymore.","commit_id":"bdb70c4d6d3f7963603edb85717dae91be6c33fb"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"7f5d9a9e78fad0ed9773148df208d39194aa6388","unresolved":false,"context_lines":[{"line_number":1899,"context_line":""},{"line_number":1900,"context_line":"# Return the current python as \"python\u003cmajor\u003e.\u003cminor\u003e\""},{"line_number":1901,"context_line":"function python_version {"},{"line_number":1902,"context_line":"    # Python 2 reports version on stderr, Python 3 on stdout"},{"line_number":1903,"context_line":"    local python_version\u003d$(python -c \u0027import sys; print(\"%s.%s\" % sys.version_info[0:2])\u0027)"},{"line_number":1904,"context_line":"    echo \"python${python_version}\""},{"line_number":1905,"context_line":"}"}],"source_content_type":"application/x-shellscript","patch_set":2,"id":"9a0c5dc1_78d5a941","line":1902,"in_reply_to":"9a0c5dc1_233a6e37","updated":"2015-05-12 18:29:58.000000000","message":"clearly I am trying to do too many things at once.","commit_id":"bdb70c4d6d3f7963603edb85717dae91be6c33fb"},{"author":{"_account_id":13252,"name":"Dr. Jens Harbott","display_name":"Jens Harbott (frickler)","email":"frickler@offenerstapel.de","username":"jrosenboom"},"change_message_id":"15f19108c8d145b2a4c01e88fd70b19007094b96","unresolved":false,"context_lines":[{"line_number":1900,"context_line":"# Return the current python as \"python\u003cmajor\u003e.\u003cminor\u003e\""},{"line_number":1901,"context_line":"function python_version {"},{"line_number":1902,"context_line":"    local python_version\u003d$(python -c \u0027import sys; print(\"%s.%s\" % sys.version_info[0:2])\u0027)"},{"line_number":1903,"context_line":"    echo \"python${python_version}\""},{"line_number":1904,"context_line":"}"},{"line_number":1905,"context_line":""},{"line_number":1906,"context_line":"# Service wrapper to restart services"}],"source_content_type":"application/x-shellscript","patch_set":3,"id":"9a0c5dc1_367cdd71","line":1903,"updated":"2015-05-12 21:13:23.000000000","message":"Well now this echo IMHO can be skipped completely, just add the \"python\" prefix into the print above and we are done, or am I missing something there?","commit_id":"3a2c86aabfa985dbdc998f02201649f49f3adab7"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"3c3927e89e166a988338bbb34a1d3e504454b03d","unresolved":false,"context_lines":[{"line_number":1900,"context_line":"# Return the current python as \"python\u003cmajor\u003e.\u003cminor\u003e\""},{"line_number":1901,"context_line":"function python_version {"},{"line_number":1902,"context_line":"    local python_version\u003d$(python -c \u0027import sys; print(\"%s.%s\" % sys.version_info[0:2])\u0027)"},{"line_number":1903,"context_line":"    echo \"python${python_version}\""},{"line_number":1904,"context_line":"}"},{"line_number":1905,"context_line":""},{"line_number":1906,"context_line":"# Service wrapper to restart services"}],"source_content_type":"application/x-shellscript","patch_set":3,"id":"9a0c5dc1_7695b5e2","line":1903,"in_reply_to":"9a0c5dc1_367cdd71","updated":"2015-05-12 21:22:18.000000000","message":"A bash function can\u0027t return anything, it can only be evaluated, so the echo is required to get the value back to the caller. So either we have the echo or we just call the python bare without assigning to python_version.\n\nI have gone with creating the variable because I kind of assumed that adding the python prefix should be a separate step to make it easier to have both a python_version and a python_name, but perhaps not I\u0027m probably being YAGNI.\n\nPreferences?","commit_id":"3a2c86aabfa985dbdc998f02201649f49f3adab7"}]}
