Skip to content

Commit

Permalink
Merge pull request #110 from ngageoint/distro
Browse files Browse the repository at this point in the history
Add setup.py for creating wheels
  • Loading branch information
asylvest authored Sep 20, 2016
2 parents ced00d9 + 8ce9999 commit 98d6e98
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.whl
*.pyc
*~

Expand Down
51 changes: 51 additions & 0 deletions six/conf/setup.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from setuptools import setup, Distribution
import sys
import glob
import os
import platform
import sys

installDir = ''
for child in os.listdir(os.getcwd()):
if os.path.isdir(child):
subdirs = os.listdir(child)
if 'tests' in subdirs:
installDir = child

packages = ''
libdir = '@LIBDIR@'
if platform.system() == 'Windows':
packages = os.path.join(libdir, 'site-packages')
else:
versionedPython = 'python{0}.{1}'.format(
sys.version_info[0], sys.version_info[1])
packages = os.path.join(
libdir, versionedPython, 'site-packages')


class BinaryDistribution(Distribution):
def is_pure(self):
return False

codaPyds = glob.glob(os.path.join(packages, 'coda', '_*'))
codaPyds = [os.path.basename(pyd) for pyd in codaPyds]

sixPyds = glob.glob(os.path.join(packages, 'pysix', '_*'))
sixPyds = [os.path.basename(pyd) for pyd in sixPyds]


setup(name = 'pysix',
version = '@SIX_VERSION@',
description = ('The Sensor Independent XML library (six), is a cross-'
'platform C++ API for reading and writing NGA\'s complex and '
'derived sensor independent radar formats. Pysix is a Python '
'wrapper to allow easy reading and writing of the complex format.'),
install_requires = [ 'numpy' ],
package_dir = {'': packages},
packages = ['pysix', 'coda'],
package_data = {
'pysix': sixPyds,
'coda': codaPyds
},
distclass = BinaryDistribution)

14 changes: 14 additions & 0 deletions six/conf/wscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os

options = distclean = lambda p: None

def configure(conf):
conf.env['SETUP_PY_DIR'] = conf.getBuildDir()

def build(bld):
bld(features='subst',
name='six_setup',
source='setup.py.in',
target='setup.py',
SIX_VERSION=bld.env['SIX_VERSION'],
LIBDIR=bld.env['install_libdir'])
2 changes: 1 addition & 1 deletion six/modules/c++/cphd/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ options = configure = distclean = lambda p: None

def build(bld):
modArgs = globals()
modArgs['VERSION'] = bld.env['VERSION']
modArgs['SIX_VERSION'] = bld.env['SIX_VERSION']
bld.module(**modArgs)
2 changes: 1 addition & 1 deletion six/modules/c++/scene/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ options = configure = distclean = lambda p: None

def build(bld):
modArgs = globals()
modArgs['VERSION'] = bld.env['VERSION']
modArgs['SIX_VERSION'] = bld.env['SIX_VERSION']
bld.module(**modArgs)
2 changes: 1 addition & 1 deletion six/modules/c++/six.sicd/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ options = configure = distclean = lambda p: None

def build(bld):
modArgs = globals()
modArgs['VERSION'] = bld.env['VERSION']
modArgs['SIX_VERSION'] = bld.env['SIX_VERSION']
bld.module(**modArgs)

# install the schemas
Expand Down
2 changes: 1 addition & 1 deletion six/modules/c++/six.sidd/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ options = configure = distclean = lambda p: None

def build(bld):
modArgs = globals()
modArgs['VERSION'] = bld.env['VERSION']
modArgs['SIX_VERSION'] = bld.env['SIX_VERSION']
bld.module(**modArgs)

# install the schemas
Expand Down
2 changes: 1 addition & 1 deletion six/modules/c++/six/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ options = configure = distclean = lambda p: None

def build(bld):
modArgs = globals()
modArgs['VERSION'] = bld.env['VERSION']
modArgs['SIX_VERSION'] = bld.env['SIX_VERSION']
bld.module(**modArgs)
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,8 @@ def initData():

# Verify the results match
if filecmp.cmp(normalPathname, streamingPathname):
print 'Results match!'
print('Results match!')
sys.exit(0)
else:
print 'Results DO NOT MATCH!'
print('Results DO NOT MATCH!')
sys.exit(1)
2 changes: 1 addition & 1 deletion six/modules/python/six/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def build(bld):
# NOTE: sio.lite-python isn't needed for the SIX bindings per se but is
# used by some of the test programs so including here for convenience
bld.swigModule(name = 'six',
use = 'six-c++ scene-python math.poly-python ' \
use = 'six-c++ numpyutils-c++ scene-python math.poly-python ' \
'except-python xml.lite-python logging-python ' \
'io-python mem-python types-python sio.lite-python',
package = 'pysix')
7 changes: 5 additions & 2 deletions six/modules/wscript
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import sys
import os

def options(opt):
opt.recurse()

def configure(conf):
conf.env['VERSION'] = '2.2.2-alpha'
conf.env['SIX_VERSION'] = '2.2.2-alpha'

# This allows us to build XML_DATA_CONTENT statically so that users don't
# have to set NITF_PLUGIN_PATH
# have to set NITF_PLUGIN_PATH
conf.env['enable_static_tres'] = True

conf.recurse()
Expand Down
6 changes: 4 additions & 2 deletions wscript
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import subprocess
from os.path import join
from waflib import Scripting, Options, Context
from build import CPPOptionsContext
Expand All @@ -22,11 +23,12 @@ def options(opt):
def configure(conf):
conf.load(TOOLS, tooldir=TOOLS_DIR)
conf.recurse(DIRS)

def build(bld):
bld.launch_dir = join(bld.launch_dir, 'six')
bld.recurse(DIRS)

def distclean(context):
context.recurse('modules projects')
context.recurse(DIRS)
Scripting.distclean(context)

0 comments on commit 98d6e98

Please sign in to comment.