Skip to content

Commit

Permalink
[codacy] Avoid usage of 'exec' statement.
Browse files Browse the repository at this point in the history
  • Loading branch information
yguclu committed Oct 31, 2019
1 parent ffe53ad commit 27221e2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
#! /usr/bin/python

from pathlib import Path
from importlib import util
from setuptools import find_packages
from numpy.distutils.core import setup
from numpy.distutils.core import Extension

# ...
# Read library version into '__version__' variable
# Load module 'psydac.version' without running file 'psydac.__init__'
path = Path(__file__).parent / 'psydac' / 'version.py'
exec(path.read_text())
spec = util.spec_from_file_location('version', str(path))
mod = util.module_from_spec(spec)
spec.loader.exec_module(mod)
# ...

NAME = 'psydac'
VERSION = __version__
VERSION = mod.__version__
AUTHOR = 'Ahmed Ratnani, Jalal Lakhlili, Yaman Güçlü'
EMAIL = 'ratnaniahmed@gmail.com'
URL = 'http://www.ahmed.ratnani.org'
Expand Down

0 comments on commit 27221e2

Please sign in to comment.