Added version generation to setup.py

Simplified __init__.py files to avoid duplicate inclusion of wafo.
master
Per.Andreas.Brodtkorb 14 years ago
parent 71852984c7
commit 51de2e3530

@ -14,9 +14,20 @@ python setup.py sdist bdist_wininst upload --show-response
""" """
#!/usr/bin/env python #!/usr/bin/env python
import os, sys
#sys.argv.append("develop") import os
import sys
import subprocess
import re
MAJOR = 0
MINOR = 1
MICRO = 1
ISRELEASED = False
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
sys.argv.append("develop")
#sys.argv.append("install") #sys.argv.append("install")
DISTUTILS_DEBUG = True DISTUTILS_DEBUG = True
pkg_name = 'wafo' pkg_name = 'wafo'
@ -33,16 +44,73 @@ if True: #__file__ == 'setupegg.py':
else: else:
from distutils.core import setup from distutils.core import setup
t = find_packages('src')
subpackages = ('spectrum','data','transform','covariance')
#subpackagesfull = [os.path.join(pkg_name,f) for f in subpackages]
subtests = [os.path.join(subpkg,'test') for subpkg in subpackages] # Return the svn version as a string, raise a ValueError otherwise
def svn_version():
from numpy.compat import asstr
env = os.environ.copy()
env['LC_ALL'] = 'C'
try:
out = subprocess.Popen(['svn', 'info'], stdout=subprocess.PIPE,
env=env).communicate()[0]
except OSError:
warnings.warn(" --- Could not run svn info --- ")
return ""
r = re.compile('Revision: ([0-9]+)')
svnver = None
for line in asstr(out).split('\n'):
m = r.match(line)
if m:
svnver = m.group(1)
if not svnver:
raise ValueError("Error while parsing svn version ?")
return svnver
FULLVERSION = VERSION
if not ISRELEASED:
FULLVERSION += '.dev'
# If in git or something, bypass the svn rev
if os.path.exists('.svn'):
FULLVERSION += svn_version()
testscripts = [os.path.join(subtst, f) for subtst in subtests def write_version_py(filename='version.py'):
cnt = """\
# THIS FILE IS GENERATED FROM SETUP.PY
short_version='%(version)s'
version='%(version)s'
release=%(isrelease)s
"""
fid = open(os.path.join(rootdir,filename), 'w')
try:
fid.write(cnt % {'version': VERSION, 'isrelease': str(ISRELEASED)})
finally:
fid.close()
if __name__=='__main__':
write_version_py()
packages = find_packages('src')
package_paths =[p.replace(pkg_name,+'.','').replace(pkg_name,'').replace('.',os.path.sep)
for p in packages]
test_paths = [os.path.join(pkg_path,'test') for pkg_path in package_paths
if os.path.exists(os.path.join(root_dir,pkg_path,'test'))]
testscripts = [os.path.join(subtst, f) for subtst in test_paths
for f in os.listdir(os.path.join(root_dir, subtst)) for f in os.listdir(os.path.join(root_dir, subtst))
if not (f.startswith('.') or f.endswith('~') or if not (f.startswith('.') or f.endswith('~') or
f.endswith('.old') or f.endswith('.bak'))] f.endswith('.old') or f.endswith('.bak'))]
#subpackages = ('spectrum','data','transform','covariance')
#subpackagesfull = [os.path.join(pkg_name,f) for f in subpackages]
#subtests = [os.path.join(subpkg,'test') for subpkg in subpackages]
#testscripts = [os.path.join(subtst, f) for subtst in subtests
# for f in os.listdir(os.path.join(root_dir, subtst))
# if not (f.startswith('.') or f.endswith('~') or
# f.endswith('.old') or f.endswith('.bak'))]
datadir = 'data' datadir = 'data'
datafiles = [os.path.join(datadir, f) for f in os.listdir(os.path.join(root_dir, datadir)) datafiles = [os.path.join(datadir, f) for f in os.listdir(os.path.join(root_dir, datadir))
if not (f.startswith('.') or f.endswith('~') or if not (f.startswith('.') or f.endswith('~') or
@ -53,7 +121,7 @@ packagedata = testscripts + datafiles + libs #['c_library.pyd'] #,'disufq1.c','d
setup( setup(
version = '0.11', version = VERSION,
author='WAFO-group', author='WAFO-group',
author_email='wafo@maths.lth.se', author_email='wafo@maths.lth.se',
decription = 'Statistical analysis and simulation of random waves and random loads', decription = 'Statistical analysis and simulation of random waves and random loads',
@ -63,7 +131,7 @@ setup(
url='http://code.google.com/p/pywafo/', url='http://code.google.com/p/pywafo/',
name = pkg_name, name = pkg_name,
package_dir = {'': 'src'}, package_dir = {'': 'src'},
packages = find_packages('src'), packages = packages,
package_data = {'': packagedata}, package_data = {'': packagedata},
classifiers=[ classifiers=[
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',

@ -4,6 +4,7 @@ gendocwafo.py
manifest manifest
setup.py setup.py
setup_old.py setup_old.py
test_all.py
src/epydoc_wafo.prj src/epydoc_wafo.prj
src/Wafo.egg-info/PKG-INFO src/Wafo.egg-info/PKG-INFO
src/Wafo.egg-info/SOURCES.txt src/Wafo.egg-info/SOURCES.txt
@ -12,7 +13,6 @@ src/Wafo.egg-info/top_level.txt
src/wafo/SpecData1D.mm src/wafo/SpecData1D.mm
src/wafo/__init__.py src/wafo/__init__.py
src/wafo/c_library.pyd src/wafo/c_library.pyd
src/wafo/data_structures.py
src/wafo/dctpack.py src/wafo/dctpack.py
src/wafo/definitions.py src/wafo/definitions.py
src/wafo/definitions.~py src/wafo/definitions.~py
@ -25,18 +25,14 @@ src/wafo/kdetools.py
src/wafo/meshgrid.py src/wafo/meshgrid.py
src/wafo/misc.py src/wafo/misc.py
src/wafo/mvn.pyd src/wafo/mvn.pyd
src/wafo/mvn.pyf
src/wafo/mvndst.f
src/wafo/mvnprdmod.pyd src/wafo/mvnprdmod.pyd
src/wafo/namedtuple.py src/wafo/namedtuple.py
src/wafo/objects.py src/wafo/objects.py
src/wafo/plotbackend.py src/wafo/plotbackend.py
src/wafo/polynomial.py src/wafo/polynomial.py
src/wafo/polynomial_old.py src/wafo/polynomial_old.py
src/wafo/ppimport.py
src/wafo/rindmod.pyd src/wafo/rindmod.pyd
src/wafo/sg_filter.py src/wafo/sg_filter.py
src/wafo/test_ppimport.py
src/wafo/wafodata.py src/wafo/wafodata.py
src/wafo.egg-info/SOURCES.txt src/wafo.egg-info/SOURCES.txt
src/wafo/covariance/__init__.py src/wafo/covariance/__init__.py
@ -100,6 +96,10 @@ src/wafo/source/mreg/rintmod.mod
src/wafo/source/mreg/sizemod.mod src/wafo/source/mreg/sizemod.mod
src/wafo/source/mreg/svd.mod src/wafo/source/mreg/svd.mod
src/wafo/source/mreg/tbrmod.mod src/wafo/source/mreg/tbrmod.mod
src/wafo/source/mvn/build_all.py
src/wafo/source/mvn/mvn.pyd
src/wafo/source/mvn/mvn.pyf
src/wafo/source/mvn/mvndst.f
src/wafo/source/mvnprd/adaptivegausskronrod.mod src/wafo/source/mvnprd/adaptivegausskronrod.mod
src/wafo/source/mvnprd/build_all.py src/wafo/source/mvnprd/build_all.py
src/wafo/source/mvnprd/erfcoremod.mod src/wafo/source/mvnprd/erfcoremod.mod
@ -264,9 +264,15 @@ src/wafo/stats/distributions.py
src/wafo/stats/distributions_juli2010.py src/wafo/stats/distributions_juli2010.py
src/wafo/stats/estimation.py src/wafo/stats/estimation.py
src/wafo/stats/misc.py src/wafo/stats/misc.py
src/wafo/stats/plotbackend.py src/wafo/stats/twolumps.py
src/wafo/test/__init__.py src/wafo/test/__init__.py
src/wafo/test/test_gaussian.py
src/wafo/test/test_misc.py
src/wafo/test/test_objects.py
src/wafo/transform/__init__.py src/wafo/transform/__init__.py
src/wafo/transform/core.py src/wafo/transform/core.py
src/wafo/transform/models.py src/wafo/transform/models.py
src/wafo/transform/models.~py src/wafo/transform/models.~py
src/wafo/transform/test/__init__.py
src/wafo/transform/test/test_models.py
src/wafo/transform/test/test_trdata.py

@ -1,10 +1,18 @@
from info import __doc__ from info import __doc__
import wafo.misc import misc
import wafo.data import data
import wafo.objects import objects
import wafo.spectrum import spectrum
import wafo.transform import transform
import wafo.definitions import definitions
import wafo.polynomial import polynomial
import wafo.stats import stats
try:
from wafo.version import version as __version__
except ImportError:
__version__='nobuilt'
from numpy.testing import Tester
test = Tester().test

@ -1,3 +1,3 @@
from wafo.data.info import __doc__ from info import __doc__
from wafo.data.info import * from info import *

@ -5,6 +5,6 @@ Spectrum package in WAFO Toolbox.
""" """
from wafo.spectrum.core import SpecData1D from core import SpecData1D
import wafo.spectrum.models import models
import wafo.spectrum.dispersion_relation import dispersion_relation

@ -5,5 +5,5 @@ Statistics package in WAFO Toolbox.
""" """
from scipy.stats import * from scipy.stats import *
from wafo.stats.core import * from core import *
from wafo.stats.distributions import * from wafo.stats.distributions import *

@ -2,5 +2,5 @@
Transform package in WAFO Toolbox. Transform package in WAFO Toolbox.
""" """
from wafo.transform.core import * from core import *
import wafo.transform.models import models

Loading…
Cancel
Save