Skip to content

Commit d52985c

Browse files
committed
Use setup.py to obtain version value for scons.
Update egg info when version string changes. Do not use git internals, the package may be built without git.
1 parent 7ddc2ea commit d52985c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

srrealmodule/SConscript

+12-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,18 @@ module = env.SharedLibrary('srreal_ext', GlobSources('*.cpp'),
1919
SHLIBPREFIX='', SHLIBSUFFIX='.so')
2020
Alias('module', module)
2121

22-
# install in a development mode
23-
gitdir = env['ENV'].get('GIT_DIR', '#/.git')
24-
gheads = Glob(gitdir + '/HEAD') + Glob(gitdir + '/refs/heads/*')
25-
egginfo = env.Command(NoCache('#/diffpy.srreal.egg-info/PKG-INFO'), gheads,
26-
'$python setup.py egg_info')
22+
# update egg info when package version changes.
23+
basedir = Dir('#').abspath
24+
version = pyoutput(
25+
'import sys\n'
26+
'sys.path.insert(0, %r)\n'
27+
'from setup import versiondata\n'
28+
'print(versiondata.get("DEFAULT", "version"))\n' % basedir)
29+
egginfo = env.Command(NoCache('#/diffpy.srreal.egg-info/PKG-INFO'),
30+
env.Value(version),
31+
'$python setup.py egg_info')
32+
33+
# install extension module in a development mode.
2734
develop = Alias('develop', [egginfo, Install('#/diffpy/srreal', module)])
2835

2936
test = env.Alias('test', develop,

0 commit comments

Comments
 (0)