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 <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
YAMAMOTO Takashi 2013-10-07 14:43:53 +09:00 committed by FUJITA Tomonori
parent d6a9890b08
commit 913f2695d6

View File

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