start centralizing filesystem operations in mapnik::util::fs - refs #1177
This commit is contained in:
parent
4f9b0ffba6
commit
0365d3e081
84 changed files with 366 additions and 344 deletions
|
@ -25,9 +25,9 @@
|
|||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <mapnik/font_engine_freetype.hpp>
|
||||
#include "mainwindow.hpp"
|
||||
|
||||
// boost
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
|
||||
int main( int argc, char **argv )
|
||||
|
|
46
include/mapnik/util/fs.hpp
Normal file
46
include/mapnik/util/fs.hpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2013 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef MAPNIK_FS_HPP
|
||||
#define MAPNIK_FS_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
|
||||
// stl
|
||||
#include <string>
|
||||
|
||||
namespace mapnik { namespace util {
|
||||
|
||||
MAPNIK_DECL bool exists(std::string const& value);
|
||||
MAPNIK_DECL bool is_directory(std::string const& value);
|
||||
MAPNIK_DECL bool remove(std::string const& value);
|
||||
MAPNIK_DECL bool is_relative(std::string const& value);
|
||||
MAPNIK_DECL std::string make_relative(std::string const& filepath, std::string const& base);
|
||||
MAPNIK_DECL std::string make_absolute(std::string const& filepath, std::string const& base);
|
||||
MAPNIK_DECL std::string dirname(std::string const& value);
|
||||
|
||||
}}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -39,7 +39,6 @@ plugin_sources = Split(
|
|||
libraries = [env['PLUGINS']['ogr']['lib']]
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
cxxflags = []
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@ libraries = [ 'xml2' ]
|
|||
libraries.append('curl')
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/datasource.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
||||
// std
|
||||
#include <sstream>
|
||||
|
@ -42,7 +40,7 @@ osm_dataset* dataset_deliverer::load_from_file(const string& file, const string&
|
|||
// Only actually load from file if we haven't done so already
|
||||
if (dataset == NULL)
|
||||
{
|
||||
if (!boost::filesystem::exists(file))
|
||||
if (!mapnik::util::exists(file))
|
||||
{
|
||||
throw mapnik::datasource_exception("OSM Plugin: '" + file + "' does not exist");
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ plugin_sources = Split(
|
|||
libraries = []
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// boost
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/ctrans.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
|
@ -111,7 +111,7 @@ raster_datasource::raster_datasource(parameters const& params)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (! boost::filesystem::exists(filename_))
|
||||
if (!mapnik::util::exists(filename_))
|
||||
{
|
||||
throw datasource_exception("Raster Plugin: " + filename_ + " does not exist");
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ plugin_sources = Split(
|
|||
libraries = [env['PLUGINS']['rasterlite']['lib']]
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
if env['PLUGIN_LINKING'] == 'shared':
|
||||
libraries.append('mapnik')
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
#include "rasterlite_featureset.hpp"
|
||||
|
||||
// boost
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/boolean.hpp>
|
||||
#include <mapnik/geom_util.hpp>
|
||||
|
@ -91,7 +91,7 @@ rasterlite_datasource::rasterlite_datasource(parameters const& params)
|
|||
else
|
||||
dataset_name_ = *file;
|
||||
|
||||
if (!boost::filesystem::exists(dataset_name_)) throw datasource_exception(dataset_name_ + " does not exist");
|
||||
if (!mapnik::util::exists(dataset_name_)) throw datasource_exception(dataset_name_ + " does not exist");
|
||||
|
||||
void *dataset = open_dataset();
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ plugin_sources = Split(
|
|||
libraries = []
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
cppdefines = []
|
||||
cxxflags = []
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
#include <boost/version.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/global.hpp>
|
||||
#include <mapnik/utils.hpp>
|
||||
#include <mapnik/boolean.hpp>
|
||||
|
@ -77,33 +77,19 @@ shape_datasource::shape_datasource(const parameters ¶ms)
|
|||
shape_name_ = *file;
|
||||
|
||||
boost::algorithm::ireplace_last(shape_name_,".shp","");
|
||||
#ifdef _WINDOWS
|
||||
if (!boost::filesystem::exists(mapnik::utf8_to_utf16(shape_name_) + L".shp"))
|
||||
#else
|
||||
if (!boost::filesystem::exists(shape_name_ + ".shp"))
|
||||
#endif
|
||||
if (!mapnik::util::exists(shape_name_ + ".shp"))
|
||||
{
|
||||
throw datasource_exception("Shape Plugin: shapefile '" + shape_name_ + ".shp' does not exist");
|
||||
}
|
||||
#ifdef _WINDOWS
|
||||
if (boost::filesystem::is_directory(mapnik::utf8_to_utf16(shape_name_) + L".shp"))
|
||||
#else
|
||||
if (boost::filesystem::is_directory(shape_name_ + ".shp"))
|
||||
#endif
|
||||
if (mapnik::util::is_directory(shape_name_ + ".shp"))
|
||||
{
|
||||
throw datasource_exception("Shape Plugin: shapefile '" + shape_name_ + ".shp' appears to be a directory not a file");
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
if (!boost::filesystem::exists(mapnik::utf8_to_utf16(shape_name_) + L".dbf"))
|
||||
#else
|
||||
if (!boost::filesystem::exists(shape_name_ + ".dbf"))
|
||||
#endif
|
||||
if (!mapnik::util::exists(shape_name_ + ".dbf"))
|
||||
{
|
||||
throw datasource_exception("Shape Plugin: shapefile '" + shape_name_ + ".dbf' does not exist");
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
#ifdef MAPNIK_STATS
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <mapnik/datasource.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
using mapnik::datasource_exception;
|
||||
|
|
|
@ -37,7 +37,6 @@ plugin_sources = Split(
|
|||
libraries = [ 'sqlite3' ]
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
|
||||
linkflags = []
|
||||
if env['SQLITE_LINKFLAGS']:
|
||||
|
|
|
@ -33,13 +33,12 @@
|
|||
#include <mapnik/timer.hpp>
|
||||
#include <mapnik/wkb.hpp>
|
||||
#include <mapnik/util/trim.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
using mapnik::box2d;
|
||||
using mapnik::coord2d;
|
||||
|
@ -91,9 +90,9 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
|
|||
dataset_name_ = *file;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
if ((dataset_name_.compare(":memory:") != 0) && (!boost::filesystem::exists(mapnik::utf8_to_utf16(dataset_name_))))
|
||||
if ((dataset_name_.compare(":memory:") != 0) && (!mapnik::util::exists(mapnik::utf8_to_utf16(dataset_name_))))
|
||||
#else
|
||||
if ((dataset_name_.compare(":memory:") != 0) && (!boost::filesystem::exists(dataset_name_)))
|
||||
if ((dataset_name_.compare(":memory:") != 0) && (!mapnik::util::exists(dataset_name_)))
|
||||
#endif
|
||||
{
|
||||
throw datasource_exception("Sqlite Plugin: " + dataset_name_ + " does not exist");
|
||||
|
@ -284,11 +283,7 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
|
|||
mapnik::progress_timer __stats2__(std::clog, "sqlite_datasource::init(use_spatial_index)");
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
if (boost::filesystem::exists(mapnik::utf8_to_utf16(index_db)))
|
||||
#else
|
||||
if (boost::filesystem::exists(index_db))
|
||||
#endif
|
||||
if (mapnik::util::exists(index_db))
|
||||
{
|
||||
dataset_->execute("attach database '" + index_db + "' as " + index_table_);
|
||||
}
|
||||
|
@ -305,32 +300,12 @@ sqlite_datasource::sqlite_datasource(parameters const& params)
|
|||
<< " FROM ("
|
||||
<< geometry_table_ << ")";
|
||||
|
||||
/*
|
||||
std::vector<sqlite_utils::rtree_type> rtree_list;
|
||||
{
|
||||
boost::shared_ptr<sqlite_resultset> rs = dataset_->execute_query(query.str());
|
||||
sqlite_utils::build_tree(rs,rtree_list);
|
||||
}
|
||||
if (sqlite_utils::create_spatial_index2(index_db,index_table_,rtree_list))
|
||||
{
|
||||
//extent_initialized_ = true;
|
||||
has_spatial_index_ = true;
|
||||
if (boost::filesystem::exists(index_db))
|
||||
{
|
||||
dataset_->execute("attach database '" + index_db + "' as " + index_table_);
|
||||
}
|
||||
}
|
||||
*/
|
||||
boost::shared_ptr<sqlite_resultset> rs = dataset_->execute_query(query.str());
|
||||
if (sqlite_utils::create_spatial_index(index_db,index_table_,rs))
|
||||
{
|
||||
//extent_initialized_ = true;
|
||||
has_spatial_index_ = true;
|
||||
#ifdef _WINDOWS
|
||||
if (boost::filesystem::exists(mapnik::utf8_to_utf16(index_db)))
|
||||
#else
|
||||
if (boost::filesystem::exists(index_db))
|
||||
#endif
|
||||
if (mapnik::util::exists(index_db))
|
||||
{
|
||||
dataset_->execute("attach database '" + index_db + "' as " + index_table_);
|
||||
}
|
||||
|
@ -391,38 +366,6 @@ sqlite_datasource::~sqlite_datasource()
|
|||
{
|
||||
}
|
||||
|
||||
#if (BOOST_FILESYSTEM_VERSION <= 2)
|
||||
namespace boost {
|
||||
namespace filesystem {
|
||||
path read_symlink(const path& p)
|
||||
{
|
||||
path symlink_path;
|
||||
|
||||
#ifdef BOOST_POSIX_API
|
||||
for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer is large enough
|
||||
{
|
||||
boost::scoped_array<char> buf(new char[path_max]);
|
||||
ssize_t result;
|
||||
if ((result=::readlink(p.string().c_str(), buf.get(), path_max))== -1)
|
||||
{
|
||||
throw std::runtime_error("could not read symlink");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(result != static_cast<ssize_t>(path_max))
|
||||
{
|
||||
symlink_path.assign(buf.get(), buf.get() + result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return symlink_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void sqlite_datasource::parse_attachdb(std::string const& attachdb) const
|
||||
{
|
||||
boost::char_separator<char> sep(",");
|
||||
|
@ -444,37 +387,10 @@ void sqlite_datasource::parse_attachdb(std::string const& attachdb) const
|
|||
// Break out the dbname and the filename
|
||||
std::string dbname = mapnik::util::trim_copy(spec.substr(0, atpos));
|
||||
std::string filename = mapnik::util::trim_copy(spec.substr(atpos + 1));
|
||||
|
||||
// Normalize the filename and make it relative to dataset_name_
|
||||
if (filename.compare(":memory:") != 0)
|
||||
if (filename.compare(":memory:") != 0 && mapnik::util::is_relative(filename))
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::path child_path(mapnik::utf8_to_utf16(filename));
|
||||
#else
|
||||
boost::filesystem::path child_path(filename);
|
||||
#endif
|
||||
|
||||
// It is a relative path. Fix it.
|
||||
if (! child_path.has_root_directory() && ! child_path.has_root_name())
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::path absolute_path(mapnik::utf8_to_utf16(dataset_name_));
|
||||
#else
|
||||
boost::filesystem::path absolute_path(dataset_name_);
|
||||
#endif
|
||||
|
||||
// support symlinks
|
||||
if (boost::filesystem::is_symlink(absolute_path))
|
||||
{
|
||||
absolute_path = boost::filesystem::read_symlink(absolute_path);
|
||||
}
|
||||
|
||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||
filename = boost::filesystem::absolute(absolute_path.parent_path() / filename).string();
|
||||
#else
|
||||
filename = boost::filesystem::complete(absolute_path.branch_path() / filename).normalize().string();
|
||||
#endif
|
||||
}
|
||||
filename = mapnik::util::make_relative(filename,dataset_name_);
|
||||
}
|
||||
|
||||
// And add an init_statement_
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
// boost
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
// stl
|
||||
#include <vector>
|
||||
|
|
|
@ -35,13 +35,12 @@
|
|||
#include <mapnik/params.hpp>
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/sql_utils.hpp>
|
||||
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
// sqlite
|
||||
extern "C" {
|
||||
|
@ -236,11 +235,7 @@ public:
|
|||
int flags;
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
bool existed = boost::filesystem::exists(mapnik::utf8_to_utf16(index_db));
|
||||
#else
|
||||
bool existed = boost::filesystem::exists(index_db);
|
||||
#endif
|
||||
bool existed = mapnik::util::exists(index_db);
|
||||
boost::shared_ptr<sqlite_connection> ds = boost::make_shared<sqlite_connection>(index_db,flags);
|
||||
|
||||
bool one_success = false;
|
||||
|
@ -333,11 +328,7 @@ public:
|
|||
{
|
||||
try
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::remove(mapnik::utf8_to_utf16(index_db));
|
||||
#else
|
||||
boost::filesystem::remove(index_db);
|
||||
#endif
|
||||
mapnik::util::remove(index_db);
|
||||
}
|
||||
catch (...) {};
|
||||
}
|
||||
|
@ -353,11 +344,7 @@ public:
|
|||
{
|
||||
try
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::remove(mapnik::utf8_to_utf16(index_db));
|
||||
#else
|
||||
boost::filesystem::remove(index_db);
|
||||
#endif
|
||||
mapnik::util::remove(index_db);
|
||||
}
|
||||
catch (...) {};
|
||||
}
|
||||
|
@ -426,12 +413,7 @@ public:
|
|||
int flags;
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
bool existed = boost::filesystem::exists(mapnik::utf8_to_utf16(index_db));
|
||||
#else
|
||||
bool existed = boost::filesystem::exists(index_db);;
|
||||
#endif
|
||||
|
||||
bool existed = mapnik::util::exists(index_db);;
|
||||
|
||||
boost::shared_ptr<sqlite_connection> ds = boost::make_shared<sqlite_connection>(index_db,flags);
|
||||
|
||||
|
@ -479,11 +461,7 @@ public:
|
|||
{
|
||||
try
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::remove(mapnik::utf8_to_utf16(index_db));
|
||||
#else
|
||||
boost::filesystem::remove(index_db);
|
||||
#endif
|
||||
mapnik::util::remove(index_db);
|
||||
}
|
||||
catch (...) {};
|
||||
}
|
||||
|
@ -499,11 +477,7 @@ public:
|
|||
{
|
||||
try
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::remove(mapnik::utf8_to_utf16(index_db));
|
||||
#else
|
||||
boost::filesystem::remove(index_db);
|
||||
#endif
|
||||
mapnik::util::remove(index_db);
|
||||
}
|
||||
catch (...) {};
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@ else: # unix, non-macos
|
|||
|
||||
source = Split(
|
||||
"""
|
||||
fs.cpp
|
||||
debug_symbolizer.cpp
|
||||
request.cpp
|
||||
well_known_srs.cpp
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <mapnik/config_error.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
#include <mapnik/plugin.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/make_shared.hpp>
|
||||
|
@ -164,21 +165,18 @@ void datasource_cache::register_datasources(std::string const& str)
|
|||
#ifdef MAPNIK_THREADSAFE
|
||||
mutex::scoped_lock lock(mutex_);
|
||||
#endif
|
||||
|
||||
boost::filesystem::path path(str);
|
||||
// TODO - only push unique paths
|
||||
plugin_directories_.push_back(str);
|
||||
boost::filesystem::directory_iterator end_itr;
|
||||
|
||||
if (exists(path) && is_directory(path))
|
||||
if (mapnik::util::exists(str) && mapnik::util::is_directory(str))
|
||||
{
|
||||
for (boost::filesystem::directory_iterator itr(path); itr != end_itr; ++itr )
|
||||
boost::filesystem::directory_iterator end_itr;
|
||||
for (boost::filesystem::directory_iterator itr(str); itr != end_itr; ++itr )
|
||||
{
|
||||
|
||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||
if (! is_directory(*itr) && is_input_plugin(itr->path().filename().string()))
|
||||
if (!boost::filesystem::is_directory(*itr) && is_input_plugin(itr->path().filename().string()))
|
||||
#else // v2
|
||||
if (! is_directory(*itr) && is_input_plugin(itr->path().leaf()))
|
||||
if (!boost::filesystem::is_directory(*itr) && is_input_plugin(itr->path().leaf()))
|
||||
#endif
|
||||
{
|
||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <mapnik/text_path.hpp>
|
||||
#include <mapnik/pixel_position.hpp>
|
||||
#include <mapnik/font_util.hpp>
|
||||
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
@ -144,12 +144,11 @@ bool freetype_engine::register_font(std::string const& file_name)
|
|||
|
||||
bool freetype_engine::register_fonts(std::string const& dir, bool recurse)
|
||||
{
|
||||
boost::filesystem::path path(dir);
|
||||
if (!boost::filesystem::exists(path))
|
||||
if (!mapnik::util::exists(dir))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!boost::filesystem::is_directory(path))
|
||||
if (!mapnik::util::is_directory(dir))
|
||||
{
|
||||
return mapnik::freetype_engine::register_font(dir);
|
||||
}
|
||||
|
|
149
src/fs.cpp
Normal file
149
src/fs.cpp
Normal file
|
@ -0,0 +1,149 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2013 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//#define BOOST_FILESYSTEM_VERSION 2
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
|
||||
#if (BOOST_FILESYSTEM_VERSION <= 2)
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace filesystem {
|
||||
path read_symlink(const path& p)
|
||||
{
|
||||
path symlink_path;
|
||||
|
||||
#ifdef BOOST_POSIX_API
|
||||
for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer is large enough
|
||||
{
|
||||
boost::scoped_array<char> buf(new char[path_max]);
|
||||
ssize_t result;
|
||||
if ((result=::readlink(p.string().c_str(), buf.get(), path_max))== -1)
|
||||
{
|
||||
throw std::runtime_error("could not read symlink");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(result != static_cast<ssize_t>(path_max))
|
||||
{
|
||||
symlink_path.assign(buf.get(), buf.get() + result);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return symlink_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
namespace util {
|
||||
|
||||
bool exists(std::string const& filepath)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
return boost::filesystem::exists(mapnik::utf8_to_utf16(filepath));
|
||||
#else
|
||||
return boost::filesystem::exists(filepath);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool is_directory(std::string const& filepath)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
return boost::filesystem::is_directory(mapnik::utf8_to_utf16(filepath));
|
||||
#else
|
||||
return boost::filesystem::is_directory(filepath);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool remove(std::string const& filepath)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
return boost::filesystem::remove(mapnik::utf8_to_utf16(filepath));
|
||||
#else
|
||||
return boost::filesystem::remove(filepath);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool is_relative(std::string const& filepath)
|
||||
{
|
||||
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::path child_path(mapnik::utf8_to_utf16(filepath));
|
||||
#else
|
||||
boost::filesystem::path child_path(filepath);
|
||||
#endif
|
||||
return (! child_path.has_root_directory() && ! child_path.has_root_name());
|
||||
}
|
||||
|
||||
|
||||
std::string make_relative(std::string const& filepath, std::string const& base)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
boost::filesystem::path absolute_path(mapnik::utf8_to_utf16(base));
|
||||
#else
|
||||
boost::filesystem::path absolute_path(base);
|
||||
#endif
|
||||
// support symlinks
|
||||
if (boost::filesystem::is_symlink(absolute_path))
|
||||
{
|
||||
absolute_path = boost::filesystem::read_symlink(absolute_path);
|
||||
}
|
||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||
return boost::filesystem::absolute(absolute_path.parent_path() / filepath).string();
|
||||
#else
|
||||
return boost::filesystem::complete(absolute_path.branch_path() / filepath).normalize().string();
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string make_absolute(std::string const& filepath, std::string const& base)
|
||||
{
|
||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||
// TODO - normalize is now deprecated, use make_preferred?
|
||||
return boost::filesystem::absolute(boost::filesystem::path(base)/filepath).string();
|
||||
#else // v2
|
||||
return boost::filesystem::complete(boost::filesystem::path(base)/filepath).normalize().string();
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string dirname(std::string const& filepath)
|
||||
{
|
||||
boost::filesystem::path bp(filepath);
|
||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||
return bp.parent_path().string();
|
||||
#else // v2
|
||||
return bp.branch_path().string();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // end namespace util
|
||||
|
||||
} // end namespace mapnik
|
|
@ -28,9 +28,7 @@
|
|||
#include <mapnik/config_error.hpp>
|
||||
#include <mapnik/util/trim.hpp>
|
||||
#include <mapnik/noncopyable.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
||||
// libxml
|
||||
#include <libxml/parser.h>
|
||||
|
@ -38,6 +36,9 @@
|
|||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/xinclude.h>
|
||||
|
||||
// stl
|
||||
#include <stdexcept>
|
||||
|
||||
#define DEFAULT_OPTIONS (XML_PARSE_NOERROR | XML_PARSE_NOENT | XML_PARSE_NOBLANKS | XML_PARSE_DTDLOAD | XML_PARSE_NOCDATA)
|
||||
|
||||
namespace mapnik
|
||||
|
@ -69,8 +70,7 @@ public:
|
|||
|
||||
void load(std::string const& filename, xml_node &node)
|
||||
{
|
||||
boost::filesystem::path path(filename);
|
||||
if (!boost::filesystem::exists(path))
|
||||
if (!mapnik::util::exists(filename))
|
||||
{
|
||||
throw config_error(std::string("Could not load map file: File does not exist"), 0, filename);
|
||||
}
|
||||
|
@ -102,8 +102,7 @@ public:
|
|||
{
|
||||
if (!base_path.empty())
|
||||
{
|
||||
boost::filesystem::path path(base_path);
|
||||
if (!boost::filesystem::exists(path)) {
|
||||
if (!mapnik::util::exists(base_path)) {
|
||||
throw config_error(std::string("Could not locate base_path '") +
|
||||
base_path + "': file or directory does not exist");
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include <mapnik/util/trim.hpp>
|
||||
#include <mapnik/marker_cache.hpp>
|
||||
#include <mapnik/noncopyable.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/optional.hpp>
|
||||
|
@ -59,7 +60,6 @@
|
|||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/xml_parser.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
// agg
|
||||
#include "agg_trans_affine.h"
|
||||
|
@ -182,15 +182,7 @@ void map_parser::parse_map(Map & map, xml_node const& pt, std::string const& bas
|
|||
}
|
||||
else if (!filename_.empty())
|
||||
{
|
||||
boost::filesystem::path xml_path(filename_);
|
||||
// TODO - should we make this absolute?
|
||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||
std::string base = xml_path.parent_path().string();
|
||||
#else // v2
|
||||
std::string base = xml_path.branch_path().string();
|
||||
#endif
|
||||
|
||||
map.set_base_path(base);
|
||||
map.set_base_path(mapnik::util::dirname(filename_));
|
||||
}
|
||||
xml_base_path_ = map.base_path();
|
||||
|
||||
|
@ -1668,21 +1660,10 @@ std::string map_parser::ensure_relative_to_xml(boost::optional<std::string> cons
|
|||
|
||||
if (!xml_base_path_.empty() && relative_to_xml_)
|
||||
{
|
||||
boost::filesystem::path rel_path(*opt_path);
|
||||
if (!rel_path.has_root_path())
|
||||
std::string starting_path = *opt_path;
|
||||
if (mapnik::util::is_relative(starting_path))
|
||||
{
|
||||
#if (BOOST_FILESYSTEM_VERSION == 3)
|
||||
// TODO - normalize is now deprecated, use make_preferred?
|
||||
boost::filesystem::path full = boost::filesystem::absolute(xml_base_path_/rel_path);
|
||||
#else // v2
|
||||
boost::filesystem::path full = boost::filesystem::complete(xml_base_path_/rel_path).normalize();
|
||||
#endif
|
||||
|
||||
MAPNIK_LOG_DEBUG(load_map) << "map_parser: Modifying relative paths to be relative to xml...";
|
||||
MAPNIK_LOG_DEBUG(load_map) << "map_parser: -- Original base path=" << *opt_path;
|
||||
MAPNIK_LOG_DEBUG(load_map) << "map_parser: -- Relative base path=" << full.string();
|
||||
|
||||
return full.string();
|
||||
return mapnik::util::make_absolute(starting_path,xml_base_path_);
|
||||
}
|
||||
}
|
||||
return *opt_path;
|
||||
|
@ -1695,7 +1676,7 @@ void map_parser::ensure_exists(std::string const& file_path)
|
|||
// validate that the filename exists if it is not a dynamic PathExpression
|
||||
if (!boost::algorithm::find_first(file_path,"[") && !boost::algorithm::find_first(file_path,"]"))
|
||||
{
|
||||
if (!boost::filesystem::exists(file_path))
|
||||
if (!mapnik::util::exists(file_path))
|
||||
{
|
||||
throw mapnik::config_error("file could not be found: '" + file_path + "'");
|
||||
}
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/mapped_memory_cache.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/interprocess/file_mapping.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
namespace mapnik
|
||||
|
@ -63,8 +63,7 @@ boost::optional<mapped_region_ptr> mapped_memory_cache::find(std::string const&
|
|||
return result;
|
||||
}
|
||||
|
||||
boost::filesystem::path path(uri);
|
||||
if (exists(path))
|
||||
if (mapnik::util::exists(uri))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
#include <mapnik/svg/svg_path_attributes.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/image_reader.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
|
@ -162,8 +162,7 @@ boost::optional<marker_ptr> marker_cache::find(std::string const& uri,
|
|||
// otherwise assume file-based
|
||||
else
|
||||
{
|
||||
boost::filesystem::path path(uri);
|
||||
if (!exists(path))
|
||||
if (!mapnik::util::exists(uri))
|
||||
{
|
||||
MAPNIK_LOG_ERROR(marker_cache) << "Marker does not exist: " << uri;
|
||||
return result;
|
||||
|
|
|
@ -104,8 +104,7 @@ public:
|
|||
|
||||
// if (!base_path.empty())
|
||||
// {
|
||||
// boost::filesystem::path path(base_path);
|
||||
// if (!boost::filesystem::exists(path)) {
|
||||
// if (!mapnik::util::exists(base_path)) {
|
||||
// throw config_error(std::string("Could not locate base_path '") +
|
||||
// base_path + "': file or directory does not exist");
|
||||
// }
|
||||
|
|
|
@ -23,9 +23,10 @@
|
|||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/image_reader.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
// iostreams
|
||||
#include <boost/iostreams/device/file.hpp>
|
||||
#include <boost/iostreams/device/array.hpp>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <boost/version.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <iostream>
|
||||
#include <mapnik/projection.hpp>
|
||||
|
@ -19,6 +18,7 @@
|
|||
#include <mapnik/config_error.hpp>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -52,7 +52,7 @@ int main(int argc, char** argv)
|
|||
map.insert_style("style",style);
|
||||
|
||||
std::string csv_plugin("./plugins/input/csv.input");
|
||||
if (boost::filesystem::exists(csv_plugin)) {
|
||||
if (mapnik::util::exists(csv_plugin)) {
|
||||
try {
|
||||
mapnik::datasource_cache::instance().register_datasource(csv_plugin);
|
||||
mapnik::parameters p;
|
||||
|
@ -78,7 +78,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
std::string shape_plugin("./plugins/input/shape.input");
|
||||
if (boost::filesystem::exists(shape_plugin)) {
|
||||
if (mapnik::util::exists(shape_plugin)) {
|
||||
try {
|
||||
mapnik::datasource_cache::instance().register_datasource(shape_plugin);
|
||||
mapnik::parameters p2;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
#include <boost/version.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
using fs::path;
|
||||
namespace sys = boost::system;
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
|
@ -28,8 +25,8 @@ int main(int argc, char** argv)
|
|||
|
||||
std::string fontdir("fonts/");
|
||||
|
||||
BOOST_TEST( fs::exists( fontdir ) );
|
||||
BOOST_TEST( fs::is_directory( fontdir ) );
|
||||
BOOST_TEST( mapnik::util::exists( fontdir ) );
|
||||
BOOST_TEST( mapnik::util::is_directory( fontdir ) );
|
||||
|
||||
std::vector<std::string> face_names;
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
#include <boost/version.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
namespace fs = boost::filesystem;
|
||||
using fs::path;
|
||||
namespace sys = boost::system;
|
||||
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
#include <mapnik/image_reader.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -29,7 +26,7 @@ int main(int argc, char** argv)
|
|||
BOOST_TEST(set_working_dir(args));
|
||||
|
||||
should_throw = "./tests/cpp_tests/data/blank.jpg";
|
||||
BOOST_TEST( fs::exists( should_throw ) );
|
||||
BOOST_TEST( mapnik::util::exists( should_throw ) );
|
||||
type = mapnik::type_from_filename(should_throw);
|
||||
BOOST_TEST( type );
|
||||
try
|
||||
|
@ -43,7 +40,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
should_throw = "./tests/cpp_tests/data/blank.png";
|
||||
BOOST_TEST( fs::exists( should_throw ) );
|
||||
BOOST_TEST( mapnik::util::exists( should_throw ) );
|
||||
type = mapnik::type_from_filename(should_throw);
|
||||
BOOST_TEST( type );
|
||||
try
|
||||
|
@ -57,7 +54,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
should_throw = "./tests/cpp_tests/data/blank.tiff";
|
||||
BOOST_TEST( fs::exists( should_throw ) );
|
||||
BOOST_TEST( mapnik::util::exists( should_throw ) );
|
||||
type = mapnik::type_from_filename(should_throw);
|
||||
BOOST_TEST( type );
|
||||
try
|
||||
|
@ -71,7 +68,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
should_throw = "./tests/data/images/xcode-CgBI.png";
|
||||
BOOST_TEST( fs::exists( should_throw ) );
|
||||
BOOST_TEST( mapnik::util::exists( should_throw ) );
|
||||
type = mapnik::type_from_filename(should_throw);
|
||||
BOOST_TEST( type );
|
||||
try
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
|
||||
inline static bool set_working_dir(std::vector<std::string> args)
|
||||
|
@ -12,7 +13,7 @@ inline static bool set_working_dir(std::vector<std::string> args)
|
|||
if (args.size() > dist+1)
|
||||
{
|
||||
std::string chdir = args.at(dist+1);
|
||||
bool exists = boost::filesystem::exists( chdir );
|
||||
bool exists = mapnik::util::exists( chdir );
|
||||
if (exists)
|
||||
{
|
||||
boost::filesystem::current_path(chdir);
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
|
||||
|
||||
def test_coord_init():
|
||||
c = mapnik.Coord(100, 100)
|
||||
|
||||
|
@ -174,4 +174,4 @@ def test_envelope_clipping():
|
|||
eq_(e1,e2)
|
||||
|
||||
if __name__ == "__main__":
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,7 +2,7 @@ import sys
|
|||
import os, mapnik
|
||||
from timeit import Timer, time
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
@ -60,4 +60,4 @@ def test_clearing_grid_data():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
|
@ -3,7 +3,7 @@
|
|||
import os
|
||||
import mapnik
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
@ -60,4 +60,4 @@ if mapnik.has_pycairo() and 'sqlite' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -126,4 +125,4 @@ def test_hit_grid():
|
|||
|
||||
if __name__ == '__main__':
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -21,4 +21,4 @@ def test_datasource_template_is_working():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -34,4 +34,4 @@ def test_serializing_arbitrary_parameters():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
|
||||
from utilities import execution_path, Todo
|
||||
|
||||
from utilities import execution_path, run_all,Todo
|
||||
import os, sys, glob, mapnik
|
||||
import itertools
|
||||
|
||||
|
@ -64,4 +62,4 @@ def test_feature_hit_count():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import itertools
|
||||
import unittest
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
import mapnik
|
||||
from binascii import unhexlify
|
||||
|
@ -89,4 +90,4 @@ def test_feature_expression_evaluation_attr_with_spaces():
|
|||
eq_(expr.evaluate(f),True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
|
||||
# Tests that exercise fonts.
|
||||
|
@ -13,4 +13,4 @@ import mapnik
|
|||
# ts = mapnik.TextSymbolizer('Name', 'Invalid Font Name', int(8), mapnik.Color('black'))
|
||||
|
||||
if __name__ == "__main__":
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -39,4 +39,4 @@ def test_loading_fontset_from_python():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -69,4 +68,4 @@ if 'geojson' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from nose.tools import *
|
||||
import os,sys
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
from utilities import Todo
|
||||
import mapnik
|
||||
from binascii import unhexlify
|
||||
|
@ -226,4 +226,4 @@ def test_wkt_collection_flattening():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import mapnik
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def test_grayscale_conversion():
|
||||
im = mapnik.Image(2,2)
|
||||
|
@ -9,4 +10,4 @@ def test_grayscale_conversion():
|
|||
eq_((pixel >> 24) & 0xff,255);
|
||||
|
||||
if __name__ == "__main__":
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -5,7 +5,7 @@ import sys
|
|||
import os, mapnik
|
||||
from timeit import Timer, time
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
@ -122,4 +122,4 @@ def do_encoding():
|
|||
if __name__ == "__main__":
|
||||
setup()
|
||||
do_encoding()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -5,7 +5,7 @@ import sys
|
|||
import os, mapnik
|
||||
from timeit import Timer, time
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
@ -64,4 +64,4 @@ def test_image_open_from_string():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
import mapnik
|
||||
|
||||
|
@ -68,4 +68,4 @@ def test_introspect_symbolizers():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
from nose.tools import *
|
||||
import os,sys
|
||||
import mapnik
|
||||
from utilities import execution_path, run_all
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
|
@ -99,4 +100,4 @@ def test_char_escaping():
|
|||
eq_(pyjson['properties']['name'],expected)
|
||||
|
||||
if __name__ == "__main__":
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#coding=utf8
|
||||
import os
|
||||
import mapnik
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import *
|
||||
|
||||
def setup():
|
||||
|
@ -32,4 +32,4 @@ if 'sqlite' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -74,4 +72,4 @@ def test_adding_datasource_to_layer():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
|
||||
# Map initialization
|
||||
|
@ -24,4 +25,4 @@ def test_layer_init():
|
|||
eq_(len(l.styles),0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
from copy import deepcopy
|
||||
|
||||
import os, mapnik
|
||||
|
@ -40,4 +40,4 @@ def setup():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -94,4 +93,4 @@ if 'shape' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
from subprocess import Popen, PIPE, STDOUT
|
||||
import os
|
||||
|
||||
|
@ -76,4 +77,4 @@ def test_mapnik_config_valid_and_invalid_option():
|
|||
eq_(process.returncode,0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
|
||||
def test_logger_init():
|
||||
|
@ -14,4 +15,4 @@ def test_logger_init():
|
|||
eq_(mapnik.logger.get_severity(),default)
|
||||
|
||||
if __name__ == "__main__":
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#coding=utf8
|
||||
import os
|
||||
import mapnik
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import *
|
||||
|
||||
def setup():
|
||||
|
@ -37,4 +37,4 @@ if 'csv' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#encoding: utf8
|
||||
import mapnik
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import *
|
||||
|
||||
def test_add_feature():
|
||||
|
@ -30,4 +31,4 @@ def test_add_feature():
|
|||
eq_(len(retrieved), 0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, contains_word
|
||||
|
||||
from utilities import execution_path, run_all, contains_word
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -66,4 +65,4 @@ def test_multi_tile_policy():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
from utilities import Todo
|
||||
import tempfile
|
||||
|
||||
|
@ -565,4 +565,4 @@ def test_rule_init():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from nose.tools import *
|
||||
|
||||
from utilities import execution_path, Todo
|
||||
from utilities import execution_path, run_all, Todo
|
||||
|
||||
import os, sys, glob, mapnik
|
||||
|
||||
|
@ -41,4 +41,4 @@ if 'shape' in plugins and 'ogr' in plugins:
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -64,4 +63,4 @@ if 'ogr' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, Todo
|
||||
|
||||
from utilities import execution_path, run_all, Todo
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -50,4 +49,4 @@ if 'osm' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -48,4 +47,4 @@ if 'shape' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
import os
|
||||
import sys
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -59,4 +58,4 @@ def test_parameters():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
from utilities import Todo
|
||||
import tempfile
|
||||
|
||||
|
@ -43,4 +43,4 @@ def test_parameters_pickle():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -5,7 +5,7 @@ import sys
|
|||
import os, mapnik
|
||||
from timeit import Timer, time
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
@ -136,4 +136,4 @@ def test_transparency_levels_aerial():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
|
@ -3,7 +3,7 @@
|
|||
import os
|
||||
import mapnik
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
datadir = '../data/pngsuite'
|
||||
|
||||
|
@ -32,4 +32,4 @@ def test_broken_pngs():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -5,7 +5,7 @@ import os
|
|||
import math
|
||||
import mapnik
|
||||
import sys
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import *
|
||||
|
||||
def setup():
|
||||
|
@ -157,4 +157,4 @@ if 'python' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import os, mapnik
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
@ -34,4 +34,4 @@ def test_query_resolution():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -41,4 +40,4 @@ if 'shape' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#coding=utf8
|
||||
import os
|
||||
import mapnik
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import *
|
||||
|
||||
def setup():
|
||||
|
@ -103,4 +103,4 @@ def test_stop_label():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#coding=utf8
|
||||
import os
|
||||
import mapnik
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
from nose.tools import *
|
||||
|
||||
def setup():
|
||||
|
@ -37,4 +37,4 @@ if 'gdal' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, contains_word, get_unique_colors
|
||||
from utilities import execution_path, run_all, contains_word, get_unique_colors
|
||||
|
||||
import os, mapnik
|
||||
|
||||
|
@ -195,4 +195,4 @@ def test_raster_warping_does_not_overclip_source():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
try:
|
||||
|
@ -382,4 +382,4 @@ def test_render_to_grid_multiple_times():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -5,7 +5,7 @@ from nose.tools import *
|
|||
import tempfile
|
||||
import os, mapnik
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
def setup():
|
||||
# All of the paths used are relative, if we run the tests
|
||||
|
@ -194,4 +194,4 @@ if 'shape' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from nose.tools import *
|
||||
from utilities import Todo
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
import tempfile
|
||||
|
||||
import os, sys, glob, mapnik
|
||||
|
@ -58,4 +58,4 @@ def test():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
|
||||
from utilities import execution_path, run_all
|
||||
import os, mapnik
|
||||
|
||||
def setup():
|
||||
|
@ -111,4 +110,4 @@ if 'shape' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
from Queue import Queue
|
||||
import threading
|
||||
|
||||
|
@ -156,4 +156,4 @@ if 'sqlite' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from nose.tools import *
|
||||
from utilities import execution_path
|
||||
from utilities import execution_path, run_all
|
||||
|
||||
import os, mapnik
|
||||
|
||||
|
@ -402,4 +402,4 @@ if 'sqlite' in mapnik.DatasourceCache.plugin_names():
|
|||
|
||||
if __name__ == "__main__":
|
||||
setup()
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import os
|
||||
from nose.tools import *
|
||||
from utilities import execution_path, run_all
|
||||
import mapnik
|
||||
|
||||
def test_style_init():
|
||||
|
@ -14,4 +15,4 @@ def test_style_init():
|
|||
eq_(s.image_filters,"")
|
||||
|
||||
if __name__ == "__main__":
|
||||
[eval(run)() for run in dir() if 'test_' in run]
|
||||
run_all(eval(x) for x in dir() if x.startswith("test_"))
|
||||
|
|
|
@ -40,7 +40,6 @@ program_env['LIBS'] = [env['PLUGINS']['ogr']['lib']]
|
|||
program_env['LIBS'].append('mapnik')
|
||||
program_env['LIBS'].append(env['ICU_LIB_NAME'])
|
||||
program_env['LIBS'].append('boost_system%s' % env['BOOST_APPEND'])
|
||||
program_env['LIBS'].append('boost_filesystem%s' % env['BOOST_APPEND'])
|
||||
program_env['LIBS'].append('boost_program_options%s' % env['BOOST_APPEND'])
|
||||
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
|
|
|
@ -27,12 +27,12 @@
|
|||
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include <mapnik/datasource.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <mapnik/feature_layer_desc.hpp>
|
||||
|
||||
#include "../shapeindex/quadtree.hpp"
|
||||
|
@ -124,7 +124,7 @@ int main (int argc,char** argv)
|
|||
|
||||
std::string ogrname (*itr++);
|
||||
|
||||
if (! boost::filesystem::exists (ogrname))
|
||||
if (! mapnik::util::exists (ogrname))
|
||||
{
|
||||
std::clog << "error : file " << ogrname << " doesn't exists" << std::endl;
|
||||
continue;
|
||||
|
@ -136,7 +136,7 @@ int main (int argc,char** argv)
|
|||
if (breakpoint == string::npos) breakpoint = ogrname.length();
|
||||
std::string ogrlayername (ogrname.substr(0, breakpoint));
|
||||
|
||||
if (boost::filesystem::exists (ogrlayername + ".ogrindex"))
|
||||
if (mapnik::util::exists (ogrlayername + ".ogrindex"))
|
||||
{
|
||||
std::clog << "error : " << ogrlayername << ".ogrindex file already exists for " << ogrname << std::endl;
|
||||
continue;
|
||||
|
|
|
@ -37,9 +37,8 @@ source += program_env.Object('box2d-static', '#src/box2d.cpp')
|
|||
headers = ['#plugins/input/shape'] + env['CPPPATH']
|
||||
|
||||
boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND']
|
||||
boost_filesystem = 'boost_filesystem%s' % env['BOOST_APPEND']
|
||||
boost_system = 'boost_system%s' % env['BOOST_APPEND']
|
||||
libraries = [boost_program_options, boost_filesystem, boost_system]
|
||||
libraries = ['mapnik', boost_program_options, boost_system]
|
||||
|
||||
if env.get('BOOST_LIB_VERSION_FROM_HEADER'):
|
||||
boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1])
|
||||
|
|
|
@ -24,10 +24,9 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <mapnik/util/fs.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include "quadtree.hpp"
|
||||
#include "shapefile.hpp"
|
||||
|
@ -122,7 +121,7 @@ int main (int argc,char** argv)
|
|||
boost::algorithm::ireplace_last(shapename,".shp","");
|
||||
std::string shapename_full (shapename+".shp");
|
||||
|
||||
if (! boost::filesystem::exists (shapename_full))
|
||||
if (! mapnik::util::exists (shapename_full))
|
||||
{
|
||||
clog << "error : file " << shapename_full << " does not exist" << endl;
|
||||
continue;
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <mapnik/svg/svg_path_attributes.hpp>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include "agg_rasterizer_scanline_aa.h"
|
||||
|
|
Loading…
Reference in a new issue