Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize sconsUtils useage and layout of the partition package. #2

Merged
merged 1 commit into from
Dec 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 22 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
.sconf_temp/
*.dylib
*.o
*.os
*.pyc
*.so
*~
core.*
.sconf_temp
.sconsign.dblite
bin/
build/
config.log
bin/sph-duplicate
bin/sph-estimate-stats
bin/sph-htm-index
bin/sph-partition-matches
bin/sph-partition
python/lsst/partition/version.py
tests/.tests/
tests/chunkIndex
tests/csv
tests/fileUtils
tests/geometry
tests/htmIndex
tests/mapReduce
tests/vector
ups/*.cfgc
32 changes: 2 additions & 30 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -1,30 +1,2 @@
# -*- python -*-
import os, sys

from lsst.sconsUtils import dependencies
from lsst.sconsUtils import env

dependencies.configure("partition")

env.Help("Spherical data partitioning and duplication utilities.")

env.Append(CCFLAGS=['-Wextra'])
if env['debug']:
# -g flag is handled by sconsUtils
build_cfg = 'debug'
else:
build_cfg = 'release'
env.Append(CCFLAGS=['-O2'])

if not os.path.isabs(env['prefix']):
# `scons prefix=<dir> install` seems buggy when <dir> is relative
env['prefix'] = os.path.normpath(os.path.join(GetLaunchDir(), env['prefix']))

env.Alias('install', ['$prefix/bin'])

# Recurse
if not GetOption('help'):
for dir in ['src', 'tests']:
variant_dir = os.path.join("build", build_cfg, dir)
SConscript(dirs=[dir], variant_dir=variant_dir)

from lsst.sconsUtils import scripts
scripts.BasicSConstruct("partition", defaultTargets=["bin", "lib", "tests"])
8 changes: 8 additions & 0 deletions bin/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import re
from lsst.sconsUtils import state

programs = []
for node in Glob('#src/sph-*.cc'):
name = re.search(r'(?P<name>sph-.*).cc$', str(node)).group('name')
programs.extend(state.env.Program(name, node, LIBS=state.env.getLibs("main")))
state.targets["bin"] = programs
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions lib/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from lsst.sconsUtils import scripts
scripts.BasicSConscript.lib(src=Glob('#src/*.cc', exclude=['*/sph-*.cc']))
6 changes: 3 additions & 3 deletions src/ChunkIndex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* see <http://www.lsstcorp.org/LegalNotices/>.
*/

#include "ChunkIndex.h"
#include "lsst/partition/ChunkIndex.h"

#include <algorithm>
#include <cmath>
Expand All @@ -31,8 +31,8 @@

#include "boost/scoped_array.hpp"

#include "Constants.h"
#include "FileUtils.h"
#include "lsst/partition/Constants.h"
#include "lsst/partition/FileUtils.h"

namespace fs = boost::filesystem;

Expand Down
4 changes: 2 additions & 2 deletions src/ChunkReducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
* see <http://www.lsstcorp.org/LegalNotices/>.
*/

#include "ChunkReducer.h"
#include "lsst/partition/ChunkReducer.h"

#include <cstdio>
#include <stdexcept>
#include <string>

#include "boost/make_shared.hpp"

#include "Hash.h"
#include "lsst/partition/Hash.h"

namespace fs = boost::filesystem;
namespace po = boost::program_options;
Expand Down
4 changes: 2 additions & 2 deletions src/Chunker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
* see <http://www.lsstcorp.org/LegalNotices/>.
*/

#include "Chunker.h"
#include "lsst/partition/Chunker.h"

#include <stdexcept>

#include "Constants.h"
#include "lsst/partition/Constants.h"

namespace po = boost::program_options;

Expand Down
6 changes: 3 additions & 3 deletions src/CmdLineUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* see <http://www.lsstcorp.org/LegalNotices/>.
*/

#include "CmdLineUtils.h"
#include "lsst/partition/CmdLineUtils.h"

#include <cstdlib>
#include <algorithm>
Expand All @@ -29,8 +29,8 @@
#include <set>
#include <vector>

#include "Constants.h"
#include "FileUtils.h"
#include "lsst/partition/Constants.h"
#include "lsst/partition/FileUtils.h"

namespace fs = boost::filesystem;
namespace po = boost::program_options;
Expand Down
2 changes: 1 addition & 1 deletion src/Csv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* see <http://www.lsstcorp.org/LegalNotices/>.
*/

#include "Csv.h"
#include "lsst/partition/Csv.h"

#include <ctype.h>
#include <errno.h>
Expand Down
2 changes: 1 addition & 1 deletion src/FileUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* see <http://www.lsstcorp.org/LegalNotices/>.
*/

#include "FileUtils.h"
#include "lsst/partition/FileUtils.h"

#include <sys/types.h>
#include <sys/stat.h>
Expand Down
4 changes: 2 additions & 2 deletions src/Geometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
* see <http://www.lsstcorp.org/LegalNotices/>.
*/

#include "Geometry.h"
#include "lsst/partition/Geometry.h"

#include <cassert>
#include <stdexcept>

#include "boost/math/constants/constants.hpp"

#include "Constants.h"
#include "lsst/partition/Constants.h"

namespace bmc = boost::math::constants;

Expand Down
10 changes: 5 additions & 5 deletions src/HtmIndex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
* see <http://www.lsstcorp.org/LegalNotices/>.
*/

#include "HtmIndex.h"
#include "lsst/partition/HtmIndex.h"

#include <algorithm>
#include <iomanip>
#include <stdexcept>

#include "boost/scoped_array.hpp"

#include "Constants.h"
#include "FileUtils.h"
#include "Geometry.h"
#include "Hash.h"
#include "lsst/partition/Constants.h"
#include "lsst/partition/FileUtils.h"
#include "lsst/partition/Geometry.h"
#include "lsst/partition/Hash.h"

namespace fs = boost::filesystem;

Expand Down
6 changes: 3 additions & 3 deletions src/InputLines.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* see <http://www.lsstcorp.org/LegalNotices/>.
*/

#include "InputLines.h"
#include "lsst/partition/InputLines.h"

#include <cstdlib>
#include <stdexcept>
Expand All @@ -29,8 +29,8 @@
#include "boost/static_assert.hpp"
#include "boost/thread.hpp"

#include "Constants.h"
#include "FileUtils.h"
#include "lsst/partition/Constants.h"
#include "lsst/partition/FileUtils.h"

namespace fs = boost::filesystem;
namespace this_thread = boost::this_thread;
Expand Down
22 changes: 0 additions & 22 deletions src/SConscript

This file was deleted.

12 changes: 6 additions & 6 deletions src/SphDuplicate.cc → src/sph-duplicate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
#include "boost/program_options.hpp"
#include "boost/shared_ptr.hpp"

#include "Chunker.h"
#include "ChunkReducer.h"
#include "CmdLineUtils.h"
#include "Csv.h"
#include "Geometry.h"
#include "HtmIndex.h"
#include "lsst/partition/Chunker.h"
#include "lsst/partition/ChunkReducer.h"
#include "lsst/partition/CmdLineUtils.h"
#include "lsst/partition/Csv.h"
#include "lsst/partition/Geometry.h"
#include "lsst/partition/HtmIndex.h"

namespace fs = boost::filesystem;
namespace po = boost::program_options;
Expand Down
10 changes: 5 additions & 5 deletions src/SphEstimateStats.cc → src/sph-estimate-stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
#include "boost/program_options.hpp"
#include "boost/shared_ptr.hpp"

#include "Chunker.h"
#include "ChunkIndex.h"
#include "CmdLineUtils.h"
#include "Geometry.h"
#include "HtmIndex.h"
#include "lsst/partition/Chunker.h"
#include "lsst/partition/ChunkIndex.h"
#include "lsst/partition/CmdLineUtils.h"
#include "lsst/partition/Geometry.h"
#include "lsst/partition/HtmIndex.h"

namespace fs = boost::filesystem;
namespace po = boost::program_options;
Expand Down
14 changes: 7 additions & 7 deletions src/SphHtmIndex.cc → src/sph-htm-index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
#include "boost/program_options.hpp"
#include "boost/shared_ptr.hpp"

#include "CmdLineUtils.h"
#include "Csv.h"
#include "FileUtils.h"
#include "Geometry.h"
#include "Hash.h"
#include "HtmIndex.h"
#include "MapReduce.h"
#include "lsst/partition/CmdLineUtils.h"
#include "lsst/partition/Csv.h"
#include "lsst/partition/FileUtils.h"
#include "lsst/partition/Geometry.h"
#include "lsst/partition/Hash.h"
#include "lsst/partition/HtmIndex.h"
#include "lsst/partition/MapReduce.h"

namespace fs = boost::filesystem;
namespace po = boost::program_options;
Expand Down
12 changes: 6 additions & 6 deletions src/SphPartitionMatches.cc → src/sph-partition-matches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
#include "boost/program_options.hpp"
#include "boost/shared_ptr.hpp"

#include "Chunker.h"
#include "ChunkIndex.h"
#include "CmdLineUtils.h"
#include "Csv.h"
#include "FileUtils.h"
#include "MapReduce.h"
#include "lsst/partition/Chunker.h"
#include "lsst/partition/ChunkIndex.h"
#include "lsst/partition/CmdLineUtils.h"
#include "lsst/partition/Csv.h"
#include "lsst/partition/FileUtils.h"
#include "lsst/partition/MapReduce.h"

namespace fs = boost::filesystem;
namespace po = boost::program_options;
Expand Down
8 changes: 4 additions & 4 deletions src/SphPartition.cc → src/sph-partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
#include "boost/program_options.hpp"
#include "boost/shared_ptr.hpp"

#include "Chunker.h"
#include "ChunkReducer.h"
#include "CmdLineUtils.h"
#include "Csv.h"
#include "lsst/partition/Chunker.h"
#include "lsst/partition/ChunkReducer.h"
#include "lsst/partition/CmdLineUtils.h"
#include "lsst/partition/Csv.h"

namespace fs = boost::filesystem;
namespace po = boost::program_options;
Expand Down
45 changes: 2 additions & 43 deletions tests/SConscript
Original file line number Diff line number Diff line change
@@ -1,43 +1,2 @@
# -*- python -*-
from __future__ import with_statement
import os, subprocess, sys
from lsst.sconsUtils import env

# If terminal supports colored text, use it for test-case PASS/FAIL messages.
def _run(cmd):
try:
process = subprocess.Popen(args=cmd.split(), stdout=subprocess.PIPE)
output, _ = process.communicate()
return '' if process.poll() else output
except:
return ''
_reset = _run('tput sgr0')
_red = _run('tput setaf 1')
_green = _run('tput setaf 2')

def red(text):
return _red + text + _reset
def green(text):
return _green + text + _reset

def runTest(target, source, env):
tgt = str(target[0])
with open(tgt + '.fail', 'w') as f:
retcode = subprocess.call(str(source[0]), stdout=f, stderr=f)
if retcode == 0:
os.rename(tgt + '.fail', tgt)
print green(str(source[0]) + ' : passed')
else:
print >>sys.stderr, red('%s : FAILED (see %s.fail)' % (source[0], tgt))
return retcode

testEnv = env.Clone()
testEnv.Append(CPPPATH=['../src'])
testEnv.Append(LIBPATH=['../src'])
# retrieving libs with sconsUtils
libs=['partition']+env.getLibs("main")+env.getLibs("test")
testEnv.Prepend(LIBS=(libs))
testEnv.Append(BUILDERS={'Test': Builder(action=runTest, suffix='.test')})

for source in testEnv.Glob('*.cc'):
Default(testEnv.Test(testEnv.Program(source)))
from lsst.sconsUtils import scripts
scripts.BasicSConscript.tests()
2 changes: 1 addition & 1 deletion tests/TempFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "boost/filesystem/path.hpp"
#include "boost/shared_ptr.hpp"

#include "FileUtils.h"
#include "lsst/partition/FileUtils.h"

namespace {
struct TempFile {
Expand Down