From 913f2695d6886ab4b04a486af0647260e51e2e48 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Mon, 7 Oct 2013 14:43:53 +0900 Subject: [PATCH] fix setup from a tarball again this makes the following work again. DIR=$(mktemp -d) git archive --format=tar HEAD | (cd ${DIR} && tar xf -) cd ${DIR} python ./setup.py install PBR_VERSION environment variable didn't work as we expected because it unconditionally overrides versions for other packages even if there are other ways to get their versions. eg. PKG_INFO. Signed-off-by: YAMAMOTO Takashi Signed-off-by: FUJITA Tomonori --- ryu/hooks.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ryu/hooks.py b/ryu/hooks.py index 3883a7d2..6d8cf9ae 100644 --- a/ryu/hooks.py +++ b/ryu/hooks.py @@ -15,6 +15,7 @@ # License for the specific language governing permissions and limitations # under the License. +import os import sys from setuptools.command import easy_install from ryu import version @@ -60,3 +61,13 @@ def setup_hook(config): packaging.override_get_script_args = my_get_script_args easy_install.get_script_args = my_get_script_args + + # another hack to allow setup from tarball. + orig_get_version = packaging.get_version + + def my_get_version(package_name, pre_version=None): + if package_name == 'ryu': + return str(version) + return orig_get_version(package_name, pre_version) + + packaging.get_version = my_get_version