From c3a22eddb18d05fb9e152cc78d327a70fdf1ad16 Mon Sep 17 00:00:00 2001 From: Nikos Skalkotos <skalkoto@grnet.gr> Date: Thu, 14 Jul 2016 10:05:53 +0300 Subject: [PATCH] setup: Don't directly import the version file Load the version module explicitly by defining its path. Weird situations may occur if you have a version of the project already installed in your system and you import project modules in setup.py --- setup.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 4bf663a..836a7ee 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (C) 2011-2015 GRNET S.A. +# Copyright (C) 2011-2016 GRNET S.A. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,16 +16,17 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -import image_creator from os.path import dirname, abspath, join - from setuptools import setup, find_packages +from imp import load_source -README = join(dirname(abspath(__file__)), 'README.md') +CWD = dirname(abspath(__file__)) +README = join(CWD, 'README.md') +VERSION = join(CWD, 'image_creator', 'version.py') setup( name='snf_image_creator', - version=image_creator.__version__, + version=getattr(load_source('version', VERSION), "__version__"), description='Command line tool for creating images', long_description=open(README).read(), url='https://github.com/grnet/snf-image', -- GitLab