From 24e37e49918222647c6fc7dc0ecad40562d1d11d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 9 Jun 2016 18:26:46 +0530 Subject: [PATCH] [fix] get_current_version backward compatibility --- bench/app.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bench/app.py b/bench/app.py index da7039df..5a2f1dfc 100755 --- a/bench/app.py +++ b/bench/app.py @@ -148,8 +148,14 @@ def fetch_upstream(app, bench='.'): def get_current_version(app, bench='.'): repo_dir = get_repo_dir(app, bench=bench) - with open(os.path.join(repo_dir, os.path.basename(repo_dir), '__init__.py')) as f: - return get_version_from_string(f.read()) + try: + with open(os.path.join(repo_dir, os.path.basename(repo_dir), '__init__.py')) as f: + return get_version_from_string(f.read()) + + except AttributeError: + # backward compatibility + with open(os.path.join(repo_dir, 'setup.py')) as f: + return get_version_from_string(f.read()) def get_upstream_version(app, branch=None, bench='.'): repo_dir = get_repo_dir(app, bench=bench)