Merge branch 'master' of github.com:mapnik/mapnik into postgis-tests-squashed

This commit is contained in:
Dane Springmeyer 2015-12-14 13:45:29 -08:00
commit dc109a7ae2
245 changed files with 2229 additions and 1081 deletions

View file

@ -8,9 +8,9 @@ For a complete change history, see the git log.
## 3.0.9
Released:
Released: November 26, 2015
(Work-in-progress)
(Packaged from 03a0926)
#### Summary
@ -24,6 +24,12 @@ Released:
- JSON parsing: unified error_handler across all grammars
- Improved unit test coverage
- Raster scaling: fixed nodata handling, acurracy when working with small floats and clipping floats by \[0; 255\] (https://github.com/mapnik/mapnik/pull/3147)
- Added [`code of conduct`](http://contributor-covenant.org)
- GeoJSON plug-in is updated to skip feature with empty geometries
- GeoJSON plug-in : ensure original order of features is preserved (fixed) (https://github.com/mapnik/mapnik/issues/3182)
- Shapeindex utility: fixed `empty` shapes handling and ported tests to c++
- Centroid algorithm: fixed invalid input handling, particularly empty geometries (https://github.com/mapnik/mapnik/pull/3185)
- Updated SCons build system to the latest version 2.4.1 (http://scons.org/)
## 3.0.8

View file

@ -1787,6 +1787,9 @@ if not preconfigured:
# TODO: clean up code more to make -Wextra -Wsign-compare -Wsign-conversion -Wconversion viable
common_cxx_flags = '-Wall %s %s -ftemplate-depth-300 -Wsign-compare -Wshadow ' % (env['WARNING_CXXFLAGS'], pthread)
if 'clang++' in env['CXX']:
common_cxx_flags += ' -Wno-unsequenced '
if env['DEBUG']:
env.Append(CXXFLAGS = common_cxx_flags + '-O0')
else:

View file

@ -27,8 +27,8 @@ namespace agg
{
public:
typedef T value_type;
pod_array_adaptor(T* array, unsigned size) :
m_array(array), m_size(size) {}
pod_array_adaptor(T* array, unsigned _size) :
m_array(array), m_size(_size) {}
unsigned size() const { return m_size; }
const T& operator [] (unsigned i) const { return m_array[i]; }
@ -87,7 +87,7 @@ namespace agg
void clear() { m_size = 0; }
void add(const T& v) { m_array[m_size++] = v; }
void push_back(const T& v) { m_array[m_size++] = v; }
void inc_size(unsigned size) { m_size += size; }
void inc_size(unsigned _size) { m_size += _size; }
unsigned size() const { return m_size; }
const T& operator [] (unsigned i) const { return m_array[i]; }
@ -112,9 +112,9 @@ namespace agg
~pod_array() { pod_allocator<T>::deallocate(m_array, m_size); }
pod_array() : m_array(0), m_size(0) {}
pod_array(unsigned size) :
m_array(pod_allocator<T>::allocate(size)),
m_size(size)
pod_array(unsigned _size) :
m_array(pod_allocator<T>::allocate(_size)),
m_size(_size)
{}
pod_array(const self_type& v) :
@ -124,12 +124,12 @@ namespace agg
memcpy(m_array, v.m_array, sizeof(T) * m_size);
}
void resize(unsigned size)
void resize(unsigned _size)
{
if(size != m_size)
if(_size != m_size)
{
pod_allocator<T>::deallocate(m_array, m_size);
m_array = pod_allocator<T>::allocate(m_size = size);
m_array = pod_allocator<T>::allocate(m_size = _size);
}
}
const self_type& operator = (const self_type& v)
@ -191,7 +191,7 @@ namespace agg
void add(const T& v) { m_array[m_size++] = v; }
void push_back(const T& v) { m_array[m_size++] = v; }
void insert_at(unsigned pos, const T& val);
void inc_size(unsigned size) { m_size += size; }
void inc_size(unsigned _size) { m_size += _size; }
unsigned size() const { return m_size; }
unsigned byte_size() const { return m_size * sizeof(T); }
void serialize(int8u* ptr) const;
@ -230,10 +230,10 @@ namespace agg
//------------------------------------------------------------------------
template<class T>
void pod_vector<T>::allocate(unsigned size, unsigned extra_tail)
void pod_vector<T>::allocate(unsigned _size, unsigned extra_tail)
{
capacity(size, extra_tail);
m_size = size;
capacity(_size, extra_tail);
m_size = _size;
}
@ -245,10 +245,10 @@ namespace agg
{
if(new_size > m_capacity)
{
T* data = pod_allocator<T>::allocate(new_size);
memcpy(data, m_array, m_size * sizeof(T));
T* _data = pod_allocator<T>::allocate(new_size);
memcpy(_data, m_array, m_size * sizeof(T));
pod_allocator<T>::deallocate(m_array, m_capacity);
m_array = data;
m_array = _data;
}
}
else
@ -289,11 +289,11 @@ namespace agg
//------------------------------------------------------------------------
template<class T>
void pod_vector<T>::deserialize(const int8u* data, unsigned byte_size)
void pod_vector<T>::deserialize(const int8u* _data, unsigned _byte_size)
{
byte_size /= sizeof(T);
allocate(byte_size);
if(byte_size) memcpy(m_array, data, byte_size * sizeof(T));
_byte_size /= sizeof(T);
allocate(_byte_size);
if(_byte_size) memcpy(m_array, _data, _byte_size * sizeof(T));
}
//------------------------------------------------------------------------
@ -371,9 +371,9 @@ namespace agg
}
}
void cut_at(unsigned size)
void cut_at(unsigned _size)
{
if(size < m_size) m_size = size;
if(_size < m_size) m_size = _size;
}
unsigned size() const { return m_size; }
@ -529,11 +529,11 @@ namespace agg
//------------------------------------------------------------------------
template<class T, unsigned S>
void pod_bvector<T, S>::free_tail(unsigned size)
void pod_bvector<T, S>::free_tail(unsigned _size)
{
if(size < m_size)
if(_size < m_size)
{
unsigned nb = (size + block_mask) >> block_shift;
unsigned nb = (_size + block_mask) >> block_shift;
while(m_num_blocks > nb)
{
pod_allocator<T>::deallocate(m_blocks[--m_num_blocks], block_size);
@ -544,7 +544,7 @@ namespace agg
m_blocks = 0;
m_max_blocks = 0;
}
m_size = size;
m_size = _size;
}
}
@ -728,16 +728,16 @@ namespace agg
//------------------------------------------------------------------------
template<class T, unsigned S>
void pod_bvector<T, S>::deserialize(const int8u* data, unsigned byte_size)
void pod_bvector<T, S>::deserialize(const int8u* _data, unsigned _byte_size)
{
remove_all();
byte_size /= sizeof(T);
for(unsigned i = 0; i < byte_size; ++i)
_byte_size /= sizeof(T);
for(unsigned i = 0; i < _byte_size; ++i)
{
T* ptr = data_ptr();
memcpy(ptr, data, sizeof(T));
memcpy(ptr, _data, sizeof(T));
++m_size;
data += sizeof(T);
_data += sizeof(T);
}
}
@ -746,27 +746,27 @@ namespace agg
//------------------------------------------------------------------------
template<class T, unsigned S>
void pod_bvector<T, S>::deserialize(unsigned start, const T& empty_val,
const int8u* data, unsigned byte_size)
const int8u* _data, unsigned _byte_size)
{
while(m_size < start)
{
add(empty_val);
}
byte_size /= sizeof(T);
for(unsigned i = 0; i < byte_size; ++i)
_byte_size /= sizeof(T);
for(unsigned i = 0; i < _byte_size; ++i)
{
if(start + i < m_size)
{
memcpy(&((*this)[start + i]), data, sizeof(T));
memcpy(&((*this)[start + i]), _data, sizeof(T));
}
else
{
T* ptr = data_ptr();
memcpy(ptr, data, sizeof(T));
memcpy(ptr, _data, sizeof(T));
++m_size;
}
data += sizeof(T);
_data += sizeof(T);
}
}
@ -1087,8 +1087,8 @@ namespace agg
public:
typedef typename Array::value_type value_type;
range_adaptor(Array& array, unsigned start, unsigned size) :
m_array(array), m_start(start), m_size(size)
range_adaptor(Array& array, unsigned start, unsigned _size) :
m_array(array), m_start(start), m_size(_size)
{}
unsigned size() const { return m_size; }

View file

@ -42,9 +42,9 @@ namespace agg
conv_clip_polygon(VertexSource& vs) :
conv_adaptor_vpgen<VertexSource, vpgen_clip_polygon>(vs) {}
void clip_box(double x1, double y1, double x2, double y2)
void clip_box(double _x1, double _y1, double _x2, double _y2)
{
base_type::vpgen().clip_box(x1, y1, x2, y2);
base_type::vpgen().clip_box(_x1, _y1, _x2, _y2);
}
double x1() const { return base_type::vpgen().x1(); }

View file

@ -42,9 +42,9 @@ namespace agg
conv_clip_polyline(VertexSource& vs) :
conv_adaptor_vpgen<VertexSource, vpgen_clip_polyline>(vs) {}
void clip_box(double x1, double y1, double x2, double y2)
void clip_box(double _x1, double _y1, double _x2, double _y2)
{
base_type::vpgen().clip_box(x1, y1, x2, y2);
base_type::vpgen().clip_box(_x1, _y1, _x2, _y2);
}
double x1() const { return base_type::vpgen().x1(); }

View file

@ -36,8 +36,8 @@ namespace mapnik {
struct attribute
{
std::string name_;
explicit attribute(std::string const& name)
: name_(name) {}
explicit attribute(std::string const& _name)
: name_(_name) {}
template <typename V ,typename F>
V const& value(F const& f) const

View file

@ -55,19 +55,19 @@ public:
premultiplied_(false)
{}
color(std::uint8_t red, std::uint8_t green, std::uint8_t blue, std::uint8_t alpha = 0xff, bool premultiplied = false)
: red_(red),
green_(green),
blue_(blue),
alpha_(alpha),
color(std::uint8_t _red, std::uint8_t _green, std::uint8_t _blue, std::uint8_t _alpha = 0xff, bool premultiplied = false)
: red_(_red),
green_(_green),
blue_(_blue),
alpha_(_alpha),
premultiplied_(premultiplied)
{}
color(std::uint32_t rgba, bool premultiplied = false)
: red_(rgba & 0xff),
green_((rgba >> 8) & 0xff),
blue_((rgba >> 16) & 0xff),
alpha_((rgba >> 24) & 0xff),
color(std::uint32_t _rgba, bool premultiplied = false)
: red_(_rgba & 0xff),
green_((_rgba >> 8) & 0xff),
blue_((_rgba >> 16) & 0xff),
alpha_((_rgba >> 24) & 0xff),
premultiplied_(premultiplied) {}
// copy ctor
@ -128,23 +128,23 @@ public:
return alpha_;
}
inline void set_red(std::uint8_t red)
inline void set_red(std::uint8_t _red)
{
red_ = red;
red_ = _red;
}
inline void set_green(std::uint8_t green)
inline void set_green(std::uint8_t _green)
{
green_ = green;
green_ = _green;
}
inline void set_blue(std::uint8_t blue)
inline void set_blue(std::uint8_t _blue)
{
blue_ = blue;
blue_ = _blue;
}
inline void set_alpha(std::uint8_t alpha)
inline void set_alpha(std::uint8_t _alpha)
{
alpha_ = alpha;
alpha_ = _alpha;
}
inline bool get_premultiplied() const
{

View file

@ -41,8 +41,8 @@ public:
illegal_enum_value():
what_() {}
illegal_enum_value( std::string const& what ) :
what_( what )
illegal_enum_value( std::string const& _what ) :
what_( _what )
{
}
virtual ~illegal_enum_value() throw() {}

View file

@ -101,15 +101,15 @@ public:
using cont_type = std::vector<value_type>;
using iterator = feature_kv_iterator;
feature_impl(context_ptr const& ctx, mapnik::value_integer id)
: id_(id),
feature_impl(context_ptr const& ctx, mapnik::value_integer _id)
: id_(_id),
ctx_(ctx),
data_(ctx_->mapping_.size()),
geom_(geometry::geometry_empty()),
raster_() {}
inline mapnik::value_integer id() const { return id_;}
inline void set_id(mapnik::value_integer id) { id_ = id;}
inline void set_id(mapnik::value_integer _id) { id_ = _id;}
template <typename T>
inline void put(context_type::key_type const& key, T const& val)
{

View file

@ -27,6 +27,7 @@
#include <mapnik/geometry_adapters.hpp>
#include <boost/geometry/algorithms/centroid.hpp>
#include <mapnik/geometry_is_empty.hpp>
#include <mapnik/geometry_remove_empty.hpp>
namespace mapnik { namespace geometry {
@ -58,60 +59,64 @@ struct geometry_centroid
result_type operator() (point<T> const& geom) const
{
boost::geometry::centroid(geom, pt_);
return true;
return centroid_simple(geom);
}
result_type operator() (line_string<T> const& geom) const
{
if (mapnik::geometry::is_empty(geom))
{
return false;
}
boost::geometry::centroid(geom, pt_);
return true;
return centroid_simple(geom);
}
result_type operator() (polygon<T> const& geom) const
{
if (mapnik::geometry::is_empty(geom))
{
return false;
}
boost::geometry::centroid(geom, pt_);
return true;
return centroid_simple(geom);
}
result_type operator() (multi_point<T> const& geom) const
{
if (mapnik::geometry::is_empty(geom))
{
return false;
}
boost::geometry::centroid(geom, pt_);
return true;
return centroid_simple(geom);
}
result_type operator() (multi_line_string<T> const& geom) const
{
if (mapnik::geometry::is_empty(geom) || mapnik::geometry::has_empty(geom))
{
return false;
}
boost::geometry::centroid(geom, pt_);
return true;
return centroid_multi(geom);
}
result_type operator() (multi_polygon<T> const& geom) const
{
if (mapnik::geometry::is_empty(geom) || mapnik::geometry::has_empty(geom))
return centroid_multi(geom);
}
point<T> & pt_;
private:
template <typename Geom>
result_type centroid_simple(Geom const & geom) const
{
try
{
boost::geometry::centroid(geom, pt_);
return true;
}
catch (boost::geometry::centroid_exception const & e)
{
return false;
}
boost::geometry::centroid(geom, pt_);
return true;
}
point<T> & pt_;
template <typename Geom>
result_type centroid_multi(Geom const & geom) const
{
// https://github.com/mapnik/mapnik/issues/3169
#if BOOST_VERSION <= 105900
if (mapnik::geometry::has_empty(geom))
{
Geom stripped = mapnik::geometry::remove_empty(geom);
return centroid_simple(stripped);
}
#endif
return centroid_simple(geom);
}
};
}

View file

@ -0,0 +1,77 @@
/*****************************************************************************
*
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2015 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_GEOMETRY_REMOVE_EMPTY_HPP
#define MAPNIK_GEOMETRY_REMOVE_EMPTY_HPP
#include <mapnik/geometry.hpp>
#include <mapnik/geometry_is_empty.hpp>
namespace mapnik { namespace geometry {
namespace detail {
struct geometry_remove_empty
{
mapnik::geometry::multi_line_string<double> operator() (mapnik::geometry::multi_line_string<double> const & geom) const
{
return remove_empty(geom);
}
mapnik::geometry::multi_polygon<double> operator() (mapnik::geometry::multi_polygon<double> const & geom) const
{
return remove_empty(geom);
}
template <typename T>
T operator() (T const & geom) const
{
return geom;
}
private:
template <typename T>
T remove_empty(T const & geom) const
{
T new_geom;
for (auto const & g : geom)
{
if (!g.empty())
{
new_geom.emplace_back(g);
}
}
return new_geom;
}
};
}
template <typename GeomType>
inline GeomType remove_empty(GeomType const& geom)
{
return detail::geometry_remove_empty()(geom);
}
}}
#endif // MAPNIK_GEOMETRY_REMOVE_EMPTY_HPP

View file

@ -49,6 +49,8 @@ struct geometry_grammar :
qi::symbols<char, int> geometry_type_dispatch;
positions_grammar<Iterator> coordinates;
boost::phoenix::function<create_geometry_impl> create_geometry;
// generic JSON
generic_json<Iterator> json_;
// error handler
ErrorHandler error_handler;
};

View file

@ -30,8 +30,6 @@
#include <boost/spirit/include/phoenix_object.hpp>
#include <boost/spirit/include/phoenix_stl.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <iostream> // for clog, endl, etc
#include <string> // for string
namespace mapnik { namespace json {
@ -51,18 +49,45 @@ geometry_grammar<Iterator, ErrorHandler>::geometry_grammar()
qi::_a_type _a;
qi::_b_type _b;
qi::eps_type eps;
qi::omit_type omit;
using qi::fail;
using qi::on_error;
using phoenix::push_back;
start = geometry.alias() | lit("null");
// generic json types
json_.value = json_.object | json_.array | json_.string_ | json_.number
;
json_.pairs = json_.key_value % lit(',')
;
json_.key_value = (json_.string_ > lit(':') > json_.value)
;
json_.object = lit('{')
> *json_.pairs
> lit('}')
;
json_.array = lit('[')
> json_.value > *(lit(',') > json_.value)
> lit(']')
;
json_.number = json_.strict_double
| json_.int__
| lit("true")
| lit ("false")
| lit("null")
;
geometry = lit('{')[_a = 0]
> (-lit(',') >> (lit("\"type\"") > lit(':') > geometry_type_dispatch[_a = _1])
^
(-lit(',') >> (lit("\"coordinates\"") > lit(':') > coordinates[_b = _1]))
^
(-lit(',') >> (lit("\"geometries\"") > lit(':') > lit('[') > geometry_collection[_val = _1] > lit(']'))))[create_geometry(_val,_a,_b)]
> (((lit("\"type\"") > lit(':') > geometry_type_dispatch[_a = _1])
|
(lit("\"coordinates\"") > lit(':') > coordinates[_b = _1])
|
(lit("\"geometries\"") > lit(':') > lit('[') > geometry_collection[_val = _1] > lit(']'))
|
omit[json_.key_value]) % lit(',')) [create_geometry(_val,_a,_b)]
> lit('}')
;

View file

@ -145,17 +145,17 @@ private:
public:
using query_iterator = tree_t::query_iterator;
explicit label_collision_detector4(box2d<double> const& extent)
: tree_(extent) {}
explicit label_collision_detector4(box2d<double> const& _extent)
: tree_(_extent) {}
bool has_placement(box2d<double> const& box)
{
tree_t::query_iterator itr = tree_.query_in_box(box);
tree_t::query_iterator end = tree_.query_end();
tree_t::query_iterator tree_itr = tree_.query_in_box(box);
tree_t::query_iterator tree_end = tree_.query_end();
for ( ;itr != end; ++itr)
for ( ;tree_itr != tree_end; ++tree_itr)
{
if (itr->get().box.intersects(box)) return false;
if (tree_itr->get().box.intersects(box)) return false;
}
return true;
@ -168,12 +168,12 @@ public:
box.maxx() + margin, box.maxy() + margin)
: box);
tree_t::query_iterator itr = tree_.query_in_box(margin_box);
tree_t::query_iterator end = tree_.query_end();
tree_t::query_iterator tree_itr = tree_.query_in_box(margin_box);
tree_t::query_iterator tree_end = tree_.query_end();
for (;itr != end; ++itr)
for (;tree_itr != tree_end; ++tree_itr)
{
if (itr->get().box.intersects(margin_box))
if (tree_itr->get().box.intersects(margin_box))
{
return false;
}
@ -196,12 +196,12 @@ public:
box.maxx() + margin, box.maxy() + margin)
: box);
tree_t::query_iterator itr = tree_.query_in_box(repeat_box);
tree_t::query_iterator end = tree_.query_end();
tree_t::query_iterator tree_itr = tree_.query_in_box(repeat_box);
tree_t::query_iterator tree_end = tree_.query_end();
for ( ;itr != end; ++itr)
for ( ;tree_itr != tree_end; ++tree_itr)
{
if (itr->get().box.intersects(margin_box) || (text == itr->get().text && itr->get().box.intersects(repeat_box)))
if (tree_itr->get().box.intersects(margin_box) || (text == tree_itr->get().text && tree_itr->get().box.intersects(repeat_box)))
{
return false;
}

View file

@ -70,9 +70,9 @@ public:
box2d<double> bounding_box() const
{
std::size_t width = bitmap_data_.width();
std::size_t height = bitmap_data_.height();
return box2d<double>(static_cast<double>(0), static_cast<double>(0), static_cast<double>(width), static_cast<double>(height));
std::size_t _width = bitmap_data_.width();
std::size_t _height = bitmap_data_.height();
return box2d<double>(static_cast<double>(0), static_cast<double>(0), static_cast<double>(_width), static_cast<double>(_height));
}
inline double width() const
@ -189,8 +189,8 @@ struct marker : marker_base
marker() = default;
template <typename T>
marker(T && data) noexcept
: marker_base(std::move(data)) {}
marker(T && _data) noexcept
: marker_base(std::move(_data)) {}
double width() const
{

View file

@ -186,8 +186,7 @@ void setup_transform_scaling(agg::trans_affine & tr,
template <typename Converter, typename Processor>
void apply_markers_multi(feature_impl const& feature, attributes const& vars, Converter & converter, Processor & proc, symbolizer_base const& sym)
{
using vertex_converter_type = Converter;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type,Processor>;
using apply_vertex_converter_type = detail::apply_vertex_converter<Converter,Processor>;
using vertex_processor_type = geometry::vertex_processor<apply_vertex_converter_type>;
auto const& geom = feature.get_geometry();

View file

@ -91,13 +91,13 @@ struct render_marker_symbolizer_visitor
vertex_stl_adapter<svg_path_storage> stl_storage(marker_ellipse->source());
svg_path_adapter svg_path(stl_storage);
build_ellipse(sym_, feature_, common_.vars_, *marker_ellipse, svg_path);
svg_attribute_type attributes;
bool result = push_explicit_style( (*stock_vector_marker)->attributes(), attributes, sym_, feature_, common_.vars_);
svg_attribute_type s_attributes;
bool result = push_explicit_style( (*stock_vector_marker)->attributes(), s_attributes, sym_, feature_, common_.vars_);
auto image_transform = get_optional<transform_type>(sym_, keys::image_transform);
if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform);
vector_dispatch_type rasterizer_dispatch(marker_ellipse,
svg_path,
result ? attributes : (*stock_vector_marker)->attributes(),
result ? s_attributes : (*stock_vector_marker)->attributes(),
image_tr,
sym_,
*common_.detector_,
@ -139,11 +139,11 @@ struct render_marker_symbolizer_visitor
if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform);
vertex_stl_adapter<svg_path_storage> stl_storage((*stock_vector_marker)->source());
svg_path_adapter svg_path(stl_storage);
svg_attribute_type attributes;
bool result = push_explicit_style( (*stock_vector_marker)->attributes(), attributes, sym_, feature_, common_.vars_);
svg_attribute_type s_attributes;
bool result = push_explicit_style( (*stock_vector_marker)->attributes(), s_attributes, sym_, feature_, common_.vars_);
vector_dispatch_type rasterizer_dispatch(*stock_vector_marker,
svg_path,
result ? attributes : (*stock_vector_marker)->attributes(),
result ? s_attributes : (*stock_vector_marker)->attributes(),
image_tr,
sym_,
*common_.detector_,

View file

@ -76,16 +76,16 @@ struct sleeve
bool inside(vertex2d const& q)
{
bool inside=false;
bool _inside=false;
for (unsigned i=0;i<4;++i)
{
if ((((v[i+1].y <= q.y) && (q.y < v[i].y)) ||
((v[i].y <= q.y) && (q.y < v[i+1].y))) &&
(q.x < (v[i].x - v[i+1].x) * (q.y - v[i+1].y)/ (v[i].y - v[i+1].y) + v[i+1].x))
inside=!inside;
_inside=!_inside;
}
return inside;
return _inside;
}
};
@ -592,11 +592,11 @@ private:
}
// Slurp the points back out that haven't been marked as discarded
for (vertex2d const& vertex : vertices)
for (vertex2d const& v : vertices)
{
if (vertex.cmd != SEG_END)
if (v.cmd != SEG_END)
{
vertices_.emplace_back(vertex);
vertices_.emplace_back(v);
}
}

View file

@ -49,7 +49,7 @@ public:
using self_type = path_adapter<VertexContainer>;
//--------------------------------------------------------------------
path_adapter(VertexContainer & vertices) : vertices_(vertices), iterator_(0) {}
path_adapter(VertexContainer & _vertices) : vertices_(_vertices), iterator_(0) {}
//void remove_all() { vertices_.remove_all(); iterator_ = 0; }
//void free_all() { vertices_.free_all(); iterator_ = 0; }

View file

@ -56,16 +56,16 @@ struct transform_path_adapter
using size_type = std::size_t;
using value_type = typename select_value_type<Geometry, void>::type;
transform_path_adapter(Transform const& t,
Geometry & geom,
transform_path_adapter(Transform const& _t,
Geometry & _geom,
proj_transform const& prj_trans)
: t_(&t),
geom_(geom),
: t_(&_t),
geom_(_geom),
prj_trans_(&prj_trans) {}
explicit transform_path_adapter(Geometry & geom)
explicit transform_path_adapter(Geometry & _geom)
: t_(0),
geom_(geom),
geom_(_geom),
prj_trans_(0) {}
void set_proj_trans(proj_transform const& prj_trans)

View file

@ -44,15 +44,15 @@ private:
int offset_;
public:
view_transform(int width, int height, box2d<double> const& extent,
double offset_x = 0.0, double offset_y = 0.0)
: width_(width),
height_(height),
extent_(extent),
view_transform(int _width, int _height, box2d<double> const& _extent,
double _offset_x = 0.0, double _offset_y = 0.0)
: width_(_width),
height_(_height),
extent_(_extent),
sx_(extent_.width() > 0 ? static_cast<double>(width_) / extent_.width() : 1.0),
sy_(extent_.height() > 0 ? static_cast<double>(height_) / extent_.height() : 1.0),
offset_x_(offset_x),
offset_y_(offset_y),
offset_x_(_offset_x),
offset_y_(_offset_y),
offset_(0) {}
view_transform(view_transform const&) = default;
@ -62,9 +62,9 @@ public:
return offset_;
}
inline void set_offset(int offset)
inline void set_offset(int _offset)
{
offset_ = offset;
offset_ = _offset;
}
inline double offset_x() const

View file

@ -22,9 +22,8 @@
#pragma GCC diagnostic ignored "-Wunknown-pragmas" // clang+gcc
#pragma GCC diagnostic ignored "-Wno-unknown-pragmas" // clang
#pragma GCC diagnostic ignored "-Wno-pragmas" // gcc
#pragma GCC diagnostic ignored "-Wno-unsequenced"
#pragma GCC diagnostic ignored "-Wpragmas" // gcc
#pragma GCC diagnostic ignored "-Wunsequenced"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wredeclared-class-member"

View file

@ -29,7 +29,7 @@ if env.get('BOOST_LIB_VERSION_FROM_HEADER'):
can_build = True
if not can_build:
print 'WARNING: skipping building the optional topojson datasource plugin which requires boost >= 1.56'
print 'WARNING: skipping building the optional CSV datasource plugin which requires boost >= 1.56'
else:
Import ('plugin_base')

View file

@ -177,28 +177,30 @@ std::tuple<char,bool,char> autodect_newline_and_quote(T & stream, std::size_t fi
// autodetect newlines
char newline = '\n';
bool has_newline = false;
char quote = '"';
bool has_quote = false;
char quote = '"';
static std::size_t const max_size = 4000;
std::size_t size = std::min(file_length, max_size);
for (std::size_t lidx = 0; lidx < size; ++lidx)
{
char c = static_cast<char>(stream.get());
if (c == '\r')
switch (c)
{
case '\r':
newline = '\r';
has_newline = true;
//break;
}
if (c == '\n')
{
break;
case '\n':
has_newline = true;
//break;
}
else if (!has_quote && c == '\'')
{
quote = '\'';
has_quote = true;
break;
case '\'':
case '"':
if (!has_quote)
{
quote = c;
has_quote = true;
}
break;
}
}
return std::make_tuple(newline, has_newline, quote);

View file

@ -567,18 +567,18 @@ mapnik::featureset_ptr geojson_datasource::features(mapnik::query const& q) cons
if (tree_)
{
tree_->query(boost::geometry::index::intersects(box),std::back_inserter(index_array));
// sort index array to preserve original feature ordering in GeoJSON
std::sort(index_array.begin(),index_array.end(),
[] (item_type const& item0, item_type const& item1)
{
return item0.second.first < item1.second.first;
});
if (cache_features_)
{
return std::make_shared<geojson_featureset>(features_, std::move(index_array));
}
else
{
std::sort(index_array.begin(),index_array.end(),
[] (item_type const& item0, item_type const& item1)
{
return item0.second.first < item1.second.first;
});
return std::make_shared<geojson_memory_index_featureset>(filename_, std::move(index_array));
}
}

View file

@ -25,9 +25,12 @@
#include <mapnik/geometry.hpp>
// ogr
#pragma GCC diagnostic push
#include <mapnik/warning_ignore.hpp>
#include "ogr_converter.hpp"
#include <ogr_core.h>
#include <ogr_geometry.h>
#pragma GCC diagnostic pop
mapnik::geometry::geometry<double> ogr_converter::convert_geometry(OGRGeometry* ogr_geom)
{

View file

@ -1,94 +0,0 @@
"""SCons.Tool.cyglink
Customization of gnulink for Cygwin (http://www.cygwin.com/)
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
import SCons.Action
import SCons.Util
import gnulink
def shlib_generator(target, source, env, for_signature):
cmd = SCons.Util.CLVar(['$SHLINK'])
dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX')
if dll: cmd.extend(['-o', dll])
cmd.extend(['$SHLINKFLAGS', '$__RPATH'])
implib = env.FindIxes(target, 'IMPLIBPREFIX', 'IMPLIBSUFFIX')
if implib:
cmd.extend([
'-Wl,--out-implib='+implib.get_string(for_signature),
'-Wl,--export-all-symbols',
'-Wl,--enable-auto-import',
'-Wl,--whole-archive', '$SOURCES',
'-Wl,--no-whole-archive', '$_LIBDIRFLAGS', '$_LIBFLAGS'
])
else:
cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS'])
return [cmd]
def shlib_emitter(target, source, env):
dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX')
no_import_lib = env.get('no_import_lib', 0)
if not dll or len(target) > 1:
raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX"))
# Remove any "lib" after the prefix
pre = env.subst('$SHLIBPREFIX')
if dll.name[len(pre):len(pre)+3] == 'lib':
dll.name = pre + dll.name[len(pre)+3:]
orig_target = target
target = [env.fs.File(dll)]
target[0].attributes.shared = 1
# Append an import lib target
if not no_import_lib:
# Create list of target libraries as strings
target_strings = env.ReplaceIxes(orig_target[0],
'SHLIBPREFIX', 'SHLIBSUFFIX',
'IMPLIBPREFIX', 'IMPLIBSUFFIX')
implib_target = env.fs.File(target_strings)
implib_target.attributes.shared = 1
target.append(implib_target)
return (target, source)
shlib_action = SCons.Action.Action(shlib_generator, generator=1)
def generate(env):
"""Add Builders and construction variables for cyglink to an Environment."""
gnulink.generate(env)
env['LINKFLAGS'] = SCons.Util.CLVar('-Wl,-no-undefined')
env['SHLINKCOM'] = shlib_action
env['LDMODULECOM'] = shlib_action
env.Append(SHLIBEMITTER = [shlib_emitter])
env['SHLIBPREFIX'] = 'cyg'
env['SHLIBSUFFIX'] = '.dll'
env['IMPLIBPREFIX'] = 'lib'
env['IMPLIBSUFFIX'] = '.dll.a'
def exists(env):
return gnulink.exists(env)
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:

View file

@ -1,218 +0,0 @@
"""SCons.Tool.link
Tool-specific initialization for the generic Posix linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/link.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
import re
import SCons.Defaults
import SCons.Tool
import SCons.Util
import SCons.Warnings
from SCons.Tool.FortranCommon import isfortran
from SCons.Tool.DCommon import isD
cplusplus = __import__('c++', globals(), locals(), [])
issued_mixed_link_warning = False
def smart_link(source, target, env, for_signature):
has_cplusplus = cplusplus.iscplusplus(source)
has_fortran = isfortran(env, source)
has_d = isD(env, source)
if has_cplusplus and has_fortran and not has_d:
global issued_mixed_link_warning
if not issued_mixed_link_warning:
msg = "Using $CXX to link Fortran and C++ code together.\n\t" + \
"This may generate a buggy executable if the '%s'\n\t" + \
"compiler does not know how to deal with Fortran runtimes."
SCons.Warnings.warn(SCons.Warnings.FortranCxxMixWarning,
msg % env.subst('$CXX'))
issued_mixed_link_warning = True
return '$CXX'
elif has_d:
env['LINKCOM'] = env['DLINKCOM']
env['SHLINKCOM'] = env['SHDLINKCOM']
return '$DC'
elif has_fortran:
return '$FORTRAN'
elif has_cplusplus:
return '$CXX'
return '$CC'
def shlib_emitter(target, source, env):
Verbose = False
platform = env.subst('$PLATFORM')
for tgt in target:
tgt.attributes.shared = 1
try:
# target[0] comes in as libtest.so. Add the version extensions
version = env.subst('$SHLIBVERSION')
if version:
version_names = shlib_emitter_names(target, source, env)
# mark the target with the shared libraries name, including
# the version number
target[0].attributes.shlibname = version_names[0]
shlib = env.File(version_names[0], directory=target[0].get_dir())
target[0].attributes.shlibpath = shlib.get_internal_path()
for name in version_names[1:]:
env.SideEffect(name, shlib)
env.Clean(shlib, name)
if Verbose:
print "shlib_emitter: add side effect - ",name
env.Clean(shlib, target[0])
return ([shlib], source)
except KeyError:
version = None
return (target, source)
def shlib_emitter_names(target, source, env):
"""Return list of file names that are side effects for a versioned library build. The first name in the list is the new name for the target"""
Verbose = False
platform = env.subst('$PLATFORM')
version_names = []
try:
# target[0] comes in as libtest.so. Add the version extensions
version = env.subst('$SHLIBVERSION')
if version.count(".") != 2:
# We need a version of the form x.y.z to proceed
raise ValueError
if version:
if platform == 'posix' or platform == 'sunos':
versionparts = version.split('.')
if hasattr(target[0].attributes, 'shlibname'):
name = target[0].attributes.shlibname
else:
name = target[0].name
# generate library name with the version number
version_name = name + '.' + version
if Verbose:
print "shlib_emitter_names: target is ", version_name
print "shlib_emitter_names: side effect: ", name
# add version_name to list of names to be a Side effect
version_names.append(version_name)
if Verbose:
print "shlib_emitter_names: versionparts ",versionparts
for ver in versionparts[0:-1]:
name = name + '.' + ver
if Verbose:
print "shlib_emitter_names: side effect: ", name
# add name to list of names to be a Side effect
version_names.append(name)
elif platform == 'darwin':
shlib_suffix = env.subst('$SHLIBSUFFIX')
if hasattr(target[0].attributes, 'shlibname'):
name = target[0].attributes.shlibname
else:
name = target[0].name
# generate library name with the version number
suffix_re = re.escape(shlib_suffix)
version_name = re.sub(suffix_re, '.' + version + shlib_suffix, name)
if Verbose:
print "shlib_emitter_names: target is ", version_name
print "shlib_emitter_names: side effect: ", name
# add version_name to list of names to be a Side effect
version_names.append(version_name)
elif platform == 'cygwin':
shlib_suffix = env.subst('$SHLIBSUFFIX')
if hasattr(target[0].attributes, 'shlibname'):
name = target[0].attributes.shlibname
else:
name = target[0].name
# generate library name with the version number
suffix_re = re.escape(shlib_suffix)
version_name = re.sub(suffix_re, '-' + re.sub('\.', '-', version) + shlib_suffix, name)
if Verbose:
print "shlib_emitter_names: target is ", version_name
print "shlib_emitter_names: side effect: ", name
# add version_name to list of names to be a Side effect
version_names.append(version_name)
except KeyError:
version = None
return version_names
def generate(env):
"""Add Builders and construction variables for gnulink to an Environment."""
SCons.Tool.createSharedLibBuilder(env)
SCons.Tool.createProgBuilder(env)
env['SHLINK'] = '$LINK'
env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared')
env['SHLINKCOM'] = '$SHLINK -o $TARGET $SHLINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
# don't set up the emitter, cause AppendUnique will generate a list
# starting with None :-(
env.Append(SHLIBEMITTER = [shlib_emitter])
env['SMARTLINK'] = smart_link
env['LINK'] = "$SMARTLINK"
env['LINKFLAGS'] = SCons.Util.CLVar('')
# __RPATH is only set to something ($_RPATH typically) on platforms that support it.
env['LINKCOM'] = '$LINK -o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
env['LIBDIRPREFIX']='-L'
env['LIBDIRSUFFIX']=''
env['_LIBFLAGS']='${_stripixes(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES, __env__)}'
env['LIBLINKPREFIX']='-l'
env['LIBLINKSUFFIX']=''
if env['PLATFORM'] == 'hpux':
env['SHLIBSUFFIX'] = '.sl'
elif env['PLATFORM'] == 'aix':
env['SHLIBSUFFIX'] = '.a'
# For most platforms, a loadable module is the same as a shared
# library. Platforms which are different can override these, but
# setting them the same means that LoadableModule works everywhere.
SCons.Tool.createLoadableModuleBuilder(env)
env['LDMODULE'] = '$SHLINK'
# don't set up the emitter, cause AppendUnique will generate a list
# starting with None :-(
env.Append(LDMODULEEMITTER='$SHLIBEMITTER')
env['LDMODULEPREFIX'] = '$SHLIBPREFIX'
env['LDMODULESUFFIX'] = '$SHLIBSUFFIX'
env['LDMODULEFLAGS'] = '$SHLINKFLAGS'
env['LDMODULECOM'] = '$LDMODULE -o $TARGET $LDMODULEFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
def exists(env):
# This module isn't really a Tool on its own, it's common logic for
# other linkers.
return None
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:

View file

@ -97,7 +97,7 @@ way for wrapping up the functions.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Action.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Action.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import dis
import os

View file

@ -97,7 +97,7 @@ There are the following methods for internal use within this module:
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Builder.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Builder.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import collections
@ -292,8 +292,8 @@ def _node_errors(builder, env, tlist, slist):
if t.has_explicit_builder():
if not t.env is None and not t.env is env:
action = t.builder.action
t_contents = action.get_contents(tlist, slist, t.env)
contents = action.get_contents(tlist, slist, env)
t_contents = t.builder.action.get_contents(tlist, slist, t.env)
contents = builder.action.get_contents(tlist, slist, env)
if t_contents == contents:
msg = "Two different environments were specified for target %s,\n\tbut they appear to have the same action: %s" % (t, action.genstring(tlist, slist, t.env))

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/CacheDir.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/CacheDir.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """
CacheDir support

View file

@ -684,6 +684,22 @@ return 0;
return ret
def CheckProg(context, prog_name):
"""
Configure check for a specific program.
Check whether program prog_name exists in path. If it is found,
returns the path for it, otherwise returns None.
"""
context.Display("Checking whether %s program exists..." % prog_name)
path = context.env.WhereIs(prog_name)
if path:
context.Display(path + "\n")
else:
context.Display("no\n")
return path
#
# END OF PUBLIC FUNCTIONS
#

View file

@ -28,7 +28,7 @@ needed by most users.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Debug.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Debug.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import os
import sys

View file

@ -33,7 +33,7 @@ from distutils.msvccompiler.
#
from __future__ import division
__revision__ = "src/engine/SCons/Defaults.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Defaults.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import os
@ -482,6 +482,15 @@ class Variable_Method_Caller(object):
frame = frame.f_back
return None
# if env[version_var] id defined, returns env[flags_var], otherwise returns None
def __libversionflags(env, version_var, flags_var):
try:
if env[version_var]:
return env[flags_var]
except KeyError:
pass
return None
ConstructionEnvironment = {
'BUILDERS' : {},
'SCANNERS' : [],
@ -499,6 +508,12 @@ ConstructionEnvironment = {
'_LIBDIRFLAGS' : '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)',
'_CPPINCFLAGS' : '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)',
'_CPPDEFFLAGS' : '${_defines(CPPDEFPREFIX, CPPDEFINES, CPPDEFSUFFIX, __env__)}',
'__libversionflags' : __libversionflags,
'__SHLIBVERSIONFLAGS' : '${__libversionflags(__env__,"SHLIBVERSION","_SHLIBVERSIONFLAGS")}',
'__LDMODULEVERSIONFLAGS' : '${__libversionflags(__env__,"LDMODULEVERSION","_LDMODULEVERSIONFLAGS")}',
'__DSHLIBVERSIONFLAGS' : '${__libversionflags(__env__,"DSHLIBVERSION","_DSHLIBVERSIONFLAGS")}',
'TEMPFILE' : NullCmdGenerator,
'Dir' : Variable_Method_Caller('TARGET', 'Dir'),
'Dirs' : Variable_Method_Caller('TARGET', 'Dirs'),

View file

@ -31,7 +31,7 @@ Environment
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Environment.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Environment.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import copy
@ -612,7 +612,7 @@ class SubstitutionEnvironment(object):
def Override(self, overrides):
"""
Produce a modified environment whose variables are overriden by
Produce a modified environment whose variables are overridden by
the overrides dictionaries. "overrides" is a dictionary that
will override the variables of this environment.

View file

@ -28,7 +28,7 @@ and user errors in SCons.
"""
__revision__ = "src/engine/SCons/Errors.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Errors.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.Util

View file

@ -27,7 +27,7 @@ Nodes.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Executor.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Executor.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import collections

View file

@ -29,7 +29,7 @@ stop, and wait on jobs.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Job.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Job.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.compat

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Memoize.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Memoize.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """Memoizer

View file

@ -30,7 +30,7 @@ This creates a hash of global Aliases (dummy targets).
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Node/Alias.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Node/Alias.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import collections

View file

@ -32,7 +32,7 @@ that can be used by scripts or modules looking for the canonical default.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Node/FS.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Node/FS.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import fnmatch
import os
@ -2182,7 +2182,12 @@ class Dir(Base):
r = [os.path.join(str(dir), x) for x in r]
result.extend(r)
if exclude:
result = filter(lambda x: not any(fnmatch.fnmatch(str(x), e) for e in SCons.Util.flatten(exclude)), result)
excludes = []
excludeList = SCons.Util.flatten(exclude)
for x in excludeList:
r = self.glob(x, ondisk, source, strings)
excludes.extend(r)
result = filter(lambda x: not any(fnmatch.fnmatch(str(x), str(e)) for e in SCons.Util.flatten(excludes)), result)
return sorted(result, key=lambda a: str(a))
def _glob1(self, pattern, ondisk=True, source=False, strings=False):

View file

@ -27,7 +27,7 @@ Python nodes.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Node/Python.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Node/Python.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.Node

View file

@ -41,7 +41,7 @@ be able to depend on any other type of "thing."
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Node/__init__.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Node/__init__.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import collections
import copy

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Options/BoolOption.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Options/BoolOption.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """Place-holder for the old SCons.Options module hierarchy

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Options/EnumOption.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Options/EnumOption.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """Place-holder for the old SCons.Options module hierarchy

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Options/ListOption.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Options/ListOption.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """Place-holder for the old SCons.Options module hierarchy

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Options/PackageOption.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Options/PackageOption.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """Place-holder for the old SCons.Options module hierarchy

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Options/PathOption.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Options/PathOption.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """Place-holder for the old SCons.Options module hierarchy

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Options/__init__.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Options/__init__.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """Place-holder for the old SCons.Options module hierarchy

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/PathList.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/PathList.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """SCons.PathList

View file

@ -42,7 +42,7 @@ their own platform definition.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/__init__.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Platform/__init__.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.compat

View file

@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/aix.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Platform/aix.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import os
import subprocess

View file

@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/cygwin.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Platform/cygwin.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import posix
from SCons.Platform import TempFileMunge
@ -42,8 +42,8 @@ def generate(env):
env['PROGSUFFIX'] = '.exe'
env['SHLIBPREFIX'] = ''
env['SHLIBSUFFIX'] = '.dll'
env['LIBPREFIXES'] = [ '$LIBPREFIX', '$SHLIBPREFIX' ]
env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ]
env['LIBPREFIXES'] = [ '$LIBPREFIX', '$SHLIBPREFIX', '$IMPLIBPREFIX' ]
env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX', '$IMPLIBSUFFIX' ]
env['TEMPFILE'] = TempFileMunge
env['TEMPFILEPREFIX'] = '@'
env['MAXLINELENGTH'] = 2048

View file

@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/darwin.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Platform/darwin.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import posix
import os

View file

@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/hpux.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Platform/hpux.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import posix

View file

@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/irix.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Platform/irix.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import posix

View file

@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/os2.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Platform/os2.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import win32
def generate(env):

View file

@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/posix.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Platform/posix.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import errno
import os

View file

@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/sunos.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Platform/sunos.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import posix

View file

@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/win32.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Platform/win32.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import os
import os.path

View file

@ -34,7 +34,7 @@ libraries are installed, if some command line options are supported etc.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/SConf.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/SConf.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.compat
@ -444,6 +444,7 @@ class SConfBase(object):
'CheckCXXHeader' : CheckCXXHeader,
'CheckLib' : CheckLib,
'CheckLibWithHeader' : CheckLibWithHeader,
'CheckProg' : CheckProg,
}
self.AddTests(default_tests)
self.AddTests(custom_tests)
@ -1047,6 +1048,14 @@ def CheckLibWithHeader(context, libs, header, language,
context.did_show_result = 1
return not res
def CheckProg(context, prog_name):
"""Simple check if a program exists in the path. Returns the path
for the application, or None if not found.
"""
res = SCons.Conftest.CheckProg(context, prog_name)
context.did_show_result = 1
return res
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil

View file

@ -27,7 +27,7 @@ Writing and reading information to the .sconsign file or files.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/SConsign.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/SConsign.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.compat

View file

@ -27,7 +27,7 @@ This module implements the depenency scanner for C/C++ code.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Scanner/C.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Scanner/C.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.Node.FS
import SCons.Scanner

View file

@ -30,7 +30,7 @@ Coded by Andy Friesen
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Scanner/D.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Scanner/D.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import re

View file

@ -20,7 +20,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Scanner/Dir.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Scanner/Dir.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.Node.FS
import SCons.Scanner

View file

@ -26,7 +26,7 @@ This module implements the dependency scanner for Fortran code.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Scanner/Fortran.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Scanner/Fortran.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import re

View file

@ -28,7 +28,7 @@ Definition Language) files.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Scanner/IDL.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Scanner/IDL.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.Node.FS
import SCons.Scanner

View file

@ -27,7 +27,7 @@ This module implements the dependency scanner for LaTeX code.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Scanner/LaTeX.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Scanner/LaTeX.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import os.path
import re

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Scanner/Prog.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Scanner/Prog.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.Node
import SCons.Node.FS

View file

@ -28,7 +28,7 @@ Definition Language) files.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Scanner/RC.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Scanner/RC.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.Node.FS
import SCons.Scanner

View file

@ -27,7 +27,7 @@ The Scanner package for the SCons software construction utility.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Scanner/__init__.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Scanner/__init__.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import re

View file

@ -20,7 +20,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Script/Interactive.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Script/Interactive.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """
SCons interactive mode

View file

@ -34,7 +34,7 @@ deprecated_python_version = (2, 7, 0)
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Script/Main.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Script/Main.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.compat
@ -484,6 +484,9 @@ def GetOption(name):
def SetOption(name, value):
return OptionsParser.values.set_option(name, value)
def PrintHelp(file=None):
OptionsParser.print_help(file=file)
#
class Stats(object):
def __init__(self):

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Script/SConsOptions.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Script/SConsOptions.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import optparse
import re
@ -268,7 +268,7 @@ class SConsOptionParser(optparse.OptionParser):
preserve_unknown_options = False
def error(self, msg):
# overriden OptionValueError exception handler
# overridden OptionValueError exception handler
self.print_usage(sys.stderr)
sys.stderr.write("SCons Error: %s\n" % msg)
sys.exit(2)

View file

@ -28,7 +28,7 @@ files.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from __future__ import division
__revision__ = "src/engine/SCons/Script/SConscript.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Script/SConscript.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons
import SCons.Action
@ -499,9 +499,9 @@ class SConsEnvironment(SCons.Environment.Base):
name = self.subst(name)
return SCons.Script.Main.GetOption(name)
def Help(self, text):
def Help(self, text, append=False):
text = self.subst(text, raw=1)
SCons.Script.HelpFunction(text)
SCons.Script.HelpFunction(text, append=append)
def Import(self, *vars):
try:

View file

@ -34,13 +34,14 @@ it goes here.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Script/__init__.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Script/__init__.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import time
start_time = time.time()
import collections
import os
import StringIO
import sys
# Special chicken-and-egg handling of the "--debug=memoizer" flag:
@ -107,6 +108,7 @@ QuestionTask = Main.QuestionTask
#SConscriptSettableOptions = Main.SConscriptSettableOptions
AddOption = Main.AddOption
PrintHelp = Main.PrintHelp
GetOption = Main.GetOption
SetOption = Main.SetOption
Progress = Main.Progress
@ -258,12 +260,25 @@ def _Set_Default_Targets(env, tlist):
#
help_text = None
def HelpFunction(text):
def HelpFunction(text, append=False):
global help_text
if SCons.Script.help_text is None:
SCons.Script.help_text = text
else:
help_text = help_text + text
if help_text is None:
if append:
s = StringIO.StringIO()
PrintHelp(s)
help_text = s.getvalue()
s.close()
else:
help_text = ""
#
# Was in original patch but this text is arbitrary and breaks tests
# so I removed it (Deegan)
# help_text = help_text + "\nLocal Build Variables:\n" + text
# else:
# help_text = help_text + text
help_text= help_text + text
#
# Will be non-zero if we are reading an SConscript file.
@ -318,6 +333,7 @@ GlobalDefaultEnvironmentFunctions = [
'Ignore',
'Install',
'InstallAs',
'InstallVersionedLib',
'Literal',
'Local',
'ParseDepends',

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Sig.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Sig.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """Place-holder for the old SCons.Sig module hierarchy

View file

@ -26,7 +26,7 @@ SCons string substitution.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Subst.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Subst.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import collections
import re

View file

@ -47,7 +47,7 @@ interface and the SCons build engine. There are two key classes here:
target(s) that it decides need to be evaluated and/or built.
"""
__revision__ = "src/engine/SCons/Taskmaster.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Taskmaster.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
from itertools import chain
import operator

View file

@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/386asm.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/386asm.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
from SCons.Tool.PharLapCommon import addPharLapPaths
import SCons.Util

View file

@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/BitKeeper.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/BitKeeper.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.Action
import SCons.Builder

View file

@ -29,7 +29,7 @@ selection method.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/CVS.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/CVS.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.Action
import SCons.Builder

View file

@ -28,7 +28,7 @@ Coded by Russel Winder (russel@winder.org.uk)
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/DCommon.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/DCommon.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import os.path

View file

@ -27,7 +27,7 @@ Stuff for processing Fortran, common to all fortran dialects.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/FortranCommon.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/FortranCommon.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import re
import os.path

View file

@ -24,7 +24,7 @@ Used by several tools of `gettext` toolset.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/GettextCommon.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/GettextCommon.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.Warnings
import re
@ -306,23 +306,6 @@ class RPaths(object):
- Tuple of strings, which represent paths relative to current working
directory (for given environment).
"""
# os.path.relpath is available only on python >= 2.6. We use our own
# implementation. It's taken from BareNecessities package:
# http://jimmyg.org/work/code/barenecessities/index.html
from posixpath import curdir
def relpath(path, start=curdir):
import posixpath
"""Return a relative version of a path"""
if not path:
raise ValueError("no path specified")
start_list = posixpath.abspath(start).split(posixpath.sep)
path_list = posixpath.abspath(path).split(posixpath.sep)
# Work out how much of the filepath is shared by start and path.
i = len(posixpath.commonprefix([start_list, path_list]))
rel_list = [posixpath.pardir] * (len(start_list)-i) + path_list[i:]
if not rel_list:
return posixpath.curdir
return posixpath.join(*rel_list)
import os
import SCons.Node.FS
rpaths = ()
@ -330,7 +313,7 @@ class RPaths(object):
for node in nodes:
rpath = None
if isinstance(node, SCons.Node.FS.Base):
rpath = relpath(node.get_abspath(), cwd)
rpath = os.path.relpath(node.get_abspath(), cwd)
# FIXME: Other types possible here?
if rpath is not None:
rpaths += (rpath,)

View file

@ -27,7 +27,7 @@ Stuff for processing Java.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/JavaCommon.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/JavaCommon.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import os
import os.path

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """
Common functions for Microsoft Visual Studio and Visual C/C++.

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/MSCommon/arch.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/MSCommon/arch.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """Module to define supported Windows chip architectures.
"""

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/MSCommon/common.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/MSCommon/common.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """
Common helper functions for working with the Microsoft tool chain.
@ -84,8 +84,8 @@ def is_win64():
return _is_win64
def read_reg(value):
return SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, value)[0]
def read_reg(value, hkroot=SCons.Util.HKEY_LOCAL_MACHINE):
return SCons.Util.RegGetValue(hkroot, value)[0]
def has_reg(value):
"""Return True if the given key exists in HKEY_LOCAL_MACHINE, False

View file

@ -20,7 +20,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/MSCommon/netframework.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/MSCommon/netframework.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """
"""

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """Module to detect the Platform/Windows SDK

View file

@ -30,11 +30,12 @@
# * test on 64 bits XP + VS 2005 (and VS 6 if possible)
# * SDK
# * Assembly
__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """Module for Visual C/C++ detection and configuration.
"""
import SCons.compat
import SCons.Util
import os
import platform
@ -137,36 +138,50 @@ def get_host_target(env):
_VCVER = ["14.0", "14.0Exp", "12.0", "12.0Exp", "11.0", "11.0Exp", "10.0", "10.0Exp", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"]
_VCVER_TO_PRODUCT_DIR = {
'14.0' : [
r'Microsoft\VisualStudio\14.0\Setup\VC\ProductDir'],
'14.0Exp' : [
r'Microsoft\VCExpress\14.0\Setup\VC\ProductDir'],
'12.0' : [
r'Microsoft\VisualStudio\12.0\Setup\VC\ProductDir'],
'12.0Exp' : [
r'Microsoft\VCExpress\12.0\Setup\VC\ProductDir'],
'11.0': [
r'Microsoft\VisualStudio\11.0\Setup\VC\ProductDir'],
'11.0Exp' : [
r'Microsoft\VCExpress\11.0\Setup\VC\ProductDir'],
'10.0': [
r'Microsoft\VisualStudio\10.0\Setup\VC\ProductDir'],
'10.0Exp' : [
r'Microsoft\VCExpress\10.0\Setup\VC\ProductDir'],
'9.0': [
r'Microsoft\VisualStudio\9.0\Setup\VC\ProductDir'],
'9.0Exp' : [
r'Microsoft\VCExpress\9.0\Setup\VC\ProductDir'],
'8.0': [
r'Microsoft\VisualStudio\8.0\Setup\VC\ProductDir'],
'8.0Exp': [
r'Microsoft\VCExpress\8.0\Setup\VC\ProductDir'],
'7.1': [
r'Microsoft\VisualStudio\7.1\Setup\VC\ProductDir'],
'7.0': [
r'Microsoft\VisualStudio\7.0\Setup\VC\ProductDir'],
'6.0': [
r'Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++\ProductDir']
'14.0' : [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VisualStudio\14.0\Setup\VC\ProductDir')],
'14.0Exp' : [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VCExpress\14.0\Setup\VC\ProductDir')],
'12.0' : [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VisualStudio\12.0\Setup\VC\ProductDir'),
],
'12.0Exp' : [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VCExpress\12.0\Setup\VC\ProductDir'),
],
'11.0': [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VisualStudio\11.0\Setup\VC\ProductDir'),
],
'11.0Exp' : [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VCExpress\11.0\Setup\VC\ProductDir'),
],
'10.0': [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VisualStudio\10.0\Setup\VC\ProductDir'),
],
'10.0Exp' : [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VCExpress\10.0\Setup\VC\ProductDir'),
],
'9.0': [
(SCons.Util.HKEY_CURRENT_USER, r'Microsoft\DevDiv\VCForPython\9.0\installdir',),
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VisualStudio\9.0\Setup\VC\ProductDir',),
],
'9.0Exp' : [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VCExpress\9.0\Setup\VC\ProductDir'),
],
'8.0': [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VisualStudio\8.0\Setup\VC\ProductDir'),
],
'8.0Exp': [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VCExpress\8.0\Setup\VC\ProductDir'),
],
'7.1': [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VisualStudio\7.1\Setup\VC\ProductDir'),
],
'7.0': [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VisualStudio\7.0\Setup\VC\ProductDir'),
],
'6.0': [
(SCons.Util.HKEY_LOCAL_MACHINE, r'Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++\ProductDir'),
]
}
def msvc_version_to_maj_min(msvc_version):
@ -216,18 +231,25 @@ def find_vc_pdir(msvc_version):
If for some reason the requested version could not be found, an
exception which inherits from VisualCException will be raised."""
root = 'Software\\'
if common.is_win64():
root = root + 'Wow6432Node\\'
try:
hkeys = _VCVER_TO_PRODUCT_DIR[msvc_version]
except KeyError:
debug("Unknown version of MSVC: %s" % msvc_version)
raise UnsupportedVersion("Unknown version %s" % msvc_version)
for key in hkeys:
key = root + key
for hkroot, key in hkeys:
try:
comps = common.read_reg(key)
comps = None
if common.is_win64():
try:
# ordinally at win64, try Wow6432Node first.
comps = common.read_reg(root + 'Wow6432Node\\' + key, hkroot)
except WindowsError, e:
# at Microsoft Visual Studio for Python 2.7, value is not in Wow6432Node
pass
if not comps:
# not Win64, or Microsoft Visual Studio for Python 2.7
comps = common.read_reg(root + key, hkroot)
except WindowsError, e:
debug('find_vc_dir(): no VC registry key %s' % repr(key))
else:

View file

@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/MSCommon/vs.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/MSCommon/vs.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
__doc__ = """Module to detect Visual Studio and/or Visual C/C++
"""

View file

@ -29,7 +29,7 @@ selection method.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/Perforce.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/Perforce.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import os

View file

@ -29,7 +29,7 @@ Phar Lap ETS tool chain. Right now, this is linkloc and
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/PharLapCommon.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/PharLapCommon.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import os
import os.path

View file

@ -29,7 +29,7 @@ selection method.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/RCS.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/RCS.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.Action
import SCons.Builder

View file

@ -29,7 +29,7 @@ selection method.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/SCCS.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/SCCS.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import SCons.Action
import SCons.Builder

View file

@ -29,7 +29,7 @@ selection method.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/Subversion.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/Subversion.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import os.path

View file

@ -35,7 +35,7 @@ tool definition.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/__init__.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/__init__.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import imp
import sys
@ -236,150 +236,436 @@ def createStaticLibBuilder(env):
return static_lib
def VersionShLibLinkNames(version, libname, env):
"""Generate names of symlinks to the versioned shared library"""
def _call_linker_cb(env, callback, args, result = None):
"""Returns the result of env['LINKCALLBACKS'][callback](*args)
if env['LINKCALLBACKS'] is a dictionary and env['LINKCALLBACKS'][callback]
is callable. If these conditions are not met, return the value provided as
the *result* argument. This function is mainly used for generating library
info such as versioned suffixes, symlink maps, sonames etc. by delegating
the core job to callbacks configured by current linker tool"""
Verbose = False
platform = env.subst('$PLATFORM')
shlib_suffix = env.subst('$SHLIBSUFFIX')
shlink_flags = SCons.Util.CLVar(env.subst('$SHLINKFLAGS'))
linknames = []
if version.count(".") != 2:
# We need a version string of the form x.y.z to proceed
# Several changes need to be made to support versions like x.y
raise ValueError
if platform == 'darwin':
# For libfoo.x.y.z.dylib, linknames libfoo.so
suffix_re = re.escape('.' + version + shlib_suffix)
linkname = re.sub(suffix_re, shlib_suffix, libname)
if Verbose:
print "VersionShLibLinkNames: linkname = ",linkname
linknames.append(linkname)
elif platform == 'posix' or platform == 'sunos':
if sys.platform.startswith('openbsd'):
# OpenBSD uses x.y shared library versioning numbering convention
# and doesn't use symlinks to backwards-compatible libraries
return []
# For libfoo.so.x.y.z, linknames libfoo.so libfoo.so.x.y libfoo.so.x
suffix_re = re.escape(shlib_suffix + '.' + version)
# First linkname has no version number
linkname = re.sub(suffix_re, shlib_suffix, libname)
if Verbose:
print "VersionShLibLinkNames: linkname = ",linkname
linknames.append(linkname)
versionparts = version.split('.')
major_name = linkname + "." + versionparts[0]
minor_name = major_name + "." + versionparts[1]
#Only add link for major_name
#for linkname in [major_name, minor_name]:
for linkname in [major_name, ]:
if Verbose:
print "VersionShLibLinkNames: linkname ",linkname, ", target ",libname
linknames.append(linkname)
# note: no Windows case here (win32 or cygwin);
# MSVC doesn't support this type of versioned shared libs.
# (could probably do something for MinGW though)
return linknames
def VersionedSharedLibrary(target = None, source= None, env=None):
"""Build a shared library. If the environment has SHLIBVERSION
defined make a versioned shared library and create the appropriate
symlinks for the platform we are on"""
Verbose = False
try:
version = env.subst('$SHLIBVERSION')
except KeyError:
version = None
# libname includes the version number if one was given
libname = getattr(target[0].attributes, 'shlibname', target[0].name)
platform = env.subst('$PLATFORM')
shlib_suffix = env.subst('$SHLIBSUFFIX')
shlink_flags = SCons.Util.CLVar(env.subst('$SHLINKFLAGS'))
if Verbose:
print "VersionShLib: libname = ",libname
print "VersionShLib: platform = ",platform
print "VersionShLib: shlib_suffix = ",shlib_suffix
print "VersionShLib: target = ",str(target[0])
if version:
# set the shared library link flags
if platform == 'posix':
shlink_flags += [ '-Wl,-Bsymbolic' ]
# OpenBSD doesn't usually use SONAME for libraries
if not sys.platform.startswith('openbsd'):
# continue setup of shlink flags for all other POSIX systems
suffix_re = re.escape(shlib_suffix + '.' + version)
(major, age, revision) = version.split(".")
# soname will have only the major version number in it
soname = re.sub(suffix_re, shlib_suffix, libname) + '.' + major
shlink_flags += [ '-Wl,-soname=%s' % soname ]
if Verbose:
print " soname ",soname,", shlink_flags ",shlink_flags
elif platform == 'sunos':
suffix_re = re.escape(shlib_suffix + '.' + version)
(major, age, revision) = version.split(".")
soname = re.sub(suffix_re, shlib_suffix, libname) + '.' + major
shlink_flags += [ '-h', soname ]
elif platform == 'cygwin':
shlink_flags += [ '-Wl,-Bsymbolic',
'-Wl,--out-implib,${TARGET.base}.a' ]
elif platform == 'darwin':
shlink_flags += [ '-current_version', '%s' % version,
'-compatibility_version', '%s' % version,
'-undefined', 'dynamic_lookup' ]
print '_call_linker_cb: args=%r' % args
print '_call_linker_cb: callback=%r' % callback
try:
cbfun = env['LINKCALLBACKS'][callback]
except (KeyError, TypeError):
if Verbose:
print "VersionShLib: shlink_flags = ",shlink_flags
envlink = env.Clone()
envlink['SHLINKFLAGS'] = shlink_flags
print '_call_linker_cb: env["LINKCALLBACKS"][%r] not found or can not be used' % callback
pass
else:
envlink = env
result = SCons.Defaults.ShLinkAction(target, source, envlink)
if version:
# here we need the full pathname so the links end up in the right directory
libname = getattr(target[0].attributes, 'shlibpath', target[0].get_internal_path())
if Verbose:
print "VerShLib: target lib is = ", libname
print "VerShLib: name is = ", target[0].name
print "VerShLib: dir is = ", target[0].dir.path
linknames = VersionShLibLinkNames(version, libname, env)
if Verbose:
print "VerShLib: linknames ",linknames
# Here we just need the file name w/o path as the target of the link
lib_ver = getattr(target[0].attributes, 'shlibname', target[0].name)
# make symlink of adjacent names in linknames
for count in range(len(linknames)):
linkname = linknames[count]
if count > 0:
try:
os.remove(lastlinkname)
except:
pass
os.symlink(os.path.basename(linkname),lastlinkname)
if Verbose:
print "VerShLib: made sym link of %s -> %s" % (lastlinkname,linkname)
lastlinkname = linkname
# finish chain of sym links with link to the actual library
if len(linknames)>0:
try:
os.remove(lastlinkname)
except:
pass
os.symlink(lib_ver,lastlinkname)
print '_call_linker_cb: env["LINKCALLBACKS"][%r] found' % callback
print '_call_linker_cb: env["LINKCALLBACKS"][%r]=%r' % (callback, cbfun)
if(callable(cbfun)):
if Verbose:
print "VerShLib: made sym link of %s -> %s" % (linkname, lib_ver)
print '_call_linker_cb: env["LINKCALLBACKS"][%r] is callable' % callback
result = cbfun(env, *args)
return result
# Fix http://scons.tigris.org/issues/show_bug.cgi?id=2903 :
# Ensure we still depend on SCons.Defaults.ShLinkAction command line which is $SHLINKCOM.
# This was tricky because we don't want changing LIBPATH to cause a rebuild, but
# changing other link args should. LIBPATH has $( ... $) around it but until this
# fix, when the varlist was added to the build sig those ignored parts weren't getting
# ignored.
ShLibAction = SCons.Action.Action(VersionedSharedLibrary, None, varlist=['SHLINKCOM'])
def _call_env_subst(env, string, *args, **kw):
kw2 = {}
for k in ('raw', 'target', 'source', 'conv', 'executor'):
try: kw2[k] = kw[k]
except KeyError: pass
return env.subst(string, *args, **kw2)
class _ShLibInfoSupport(object):
def get_libtype(self):
return 'ShLib'
def get_lib_prefix(self, env, *args, **kw):
return _call_env_subst(env,'$SHLIBPREFIX', *args, **kw)
def get_lib_suffix(self, env, *args, **kw):
return _call_env_subst(env,'$SHLIBSUFFIX', *args, **kw)
def get_lib_version(self, env, *args, **kw):
return _call_env_subst(env,'$SHLIBVERSION', *args, **kw)
def get_lib_noversionsymlinks(self, env, *args, **kw):
return _call_env_subst(env,'$SHLIBNOVERSIONSYMLINKS', *args, **kw)
class _LdModInfoSupport(object):
def get_libtype(self):
return 'LdMod'
def get_lib_prefix(self, env, *args, **kw):
return _call_env_subst(env,'$LDMODULEPREFIX', *args, **kw)
def get_lib_suffix(self, env, *args, **kw):
return _call_env_subst(env,'$LDMODULESUFFIX', *args, **kw)
def get_lib_version(self, env, *args, **kw):
return _call_env_subst(env,'$LDMODULEVERSION', *args, **kw)
def get_lib_noversionsymlinks(self, env, *args, **kw):
return _call_env_subst(env,'$LDMODULENOVERSIONSYMLINKS', *args, **kw)
class _ImpLibInfoSupport(object):
def get_libtype(self):
return 'ImpLib'
def get_lib_prefix(self, env, *args, **kw):
return _call_env_subst(env,'$IMPLIBPREFIX', *args, **kw)
def get_lib_suffix(self, env, *args, **kw):
return _call_env_subst(env,'$IMPLIBSUFFIX', *args, **kw)
def get_lib_version(self, env, *args, **kw):
version = _call_env_subst(env,'$IMPLIBVERSION', *args, **kw)
if not version:
try: lt = kw['implib_libtype']
except KeyError: pass
else:
if lt == 'ShLib':
version = _call_env_subst(env,'$SHLIBVERSION', *args, **kw)
elif lt == 'LdMod':
version = _call_env_subst(env,'$LDMODULEVERSION', *args, **kw)
return version
def get_lib_noversionsymlinks(self, env, *args, **kw):
disable = None
try: env['IMPLIBNOVERSIONSYMLINKS']
except KeyError:
try: lt = kw['implib_libtype']
except KeyError: pass
else:
if lt == 'ShLib':
disable = _call_env_subst(env,'$SHLIBNOVERSIONSYMLINKS', *args, **kw)
elif lt == 'LdMod':
disable = _call_env_subst(env,'$LDMODULENOVERSIONSYMLINKS', *args, **kw)
else:
disable = _call_env_subst(env,'$IMPLIBNOVERSIONSYMLINKS', *args, **kw)
return disable
class _LibInfoGeneratorBase(object):
"""Generator base class for library-related info such as suffixes for
versioned libraries, symlink maps, sonames etc. It handles commonities
of SharedLibrary and LoadableModule
"""
_support_classes = { 'ShLib' : _ShLibInfoSupport,
'LdMod' : _LdModInfoSupport,
'ImpLib' : _ImpLibInfoSupport }
def __init__(self, libtype, infoname):
self.set_libtype(libtype)
self.set_infoname(infoname)
def set_libtype(self, libtype):
try:
support_class = self._support_classes[libtype]
except KeyError:
raise ValueError('unsupported libtype %r' % libtype)
self._support = support_class()
def get_libtype(self):
return self._support.get_libtype()
def set_infoname(self, infoname):
self.infoname = infoname
def get_infoname(self):
return self.infoname
def get_lib_prefix(self, env, *args, **kw):
return self._support.get_lib_prefix(env,*args,**kw)
def get_lib_suffix(self, env, *args, **kw):
return self._support.get_lib_suffix(env,*args,**kw)
def get_lib_version(self, env, *args, **kw):
return self._support.get_lib_version(env,*args,**kw)
def get_lib_noversionsymlinks(self, env, *args, **kw):
return self._support.get_lib_noversionsymlinks(env,*args,**kw)
# Returns name of generator linker callback that shall be used to generate
# our info for a versioned library. For example, if our libtype is 'ShLib'
# and infoname is 'Prefix', it would return 'VersionedShLibPrefix'.
def get_versioned_lib_info_generator(self, **kw):
try: libtype = kw['generator_libtype']
except KeyError: libtype = self.get_libtype()
infoname = self.get_infoname()
return 'Versioned%s%s' % (libtype, infoname)
def generate_versioned_lib_info(self, env, args, result = None, **kw):
callback = self.get_versioned_lib_info_generator(**kw)
return _call_linker_cb(env, callback, args, result)
class _LibPrefixGenerator(_LibInfoGeneratorBase):
"""Library prefix generator, used as target_prefix in SharedLibrary and
LoadableModule builders"""
def __init__(self, libtype):
super(_LibPrefixGenerator, self).__init__(libtype, 'Prefix')
def __call__(self, env, sources = None, **kw):
Verbose = False
if sources and 'source' not in kw:
kw2 = kw.copy()
kw2['source'] = sources
else:
kw2 = kw
prefix = self.get_lib_prefix(env,**kw2)
if Verbose:
print "_LibPrefixGenerator: input prefix=%r" % prefix
version = self.get_lib_version(env, **kw2)
if Verbose:
print "_LibPrefixGenerator: version=%r" % version
if version:
prefix = self.generate_versioned_lib_info(env, [prefix, version], prefix, **kw2)
if Verbose:
print "_LibPrefixGenerator: return prefix=%r" % prefix
return prefix
ShLibPrefixGenerator = _LibPrefixGenerator('ShLib')
LdModPrefixGenerator = _LibPrefixGenerator('LdMod')
ImpLibPrefixGenerator = _LibPrefixGenerator('ImpLib')
class _LibSuffixGenerator(_LibInfoGeneratorBase):
"""Library suffix generator, used as target_suffix in SharedLibrary and
LoadableModule builders"""
def __init__(self, libtype):
super(_LibSuffixGenerator, self).__init__(libtype, 'Suffix')
def __call__(self, env, sources = None, **kw):
Verbose = False
if sources and 'source' not in kw:
kw2 = kw.copy()
kw2['source'] = sources
else:
kw2 = kw
suffix = self.get_lib_suffix(env, **kw2)
if Verbose:
print "_LibSuffixGenerator: input suffix=%r" % suffix
version = self.get_lib_version(env, **kw2)
if Verbose:
print "_LibSuffixGenerator: version=%r" % version
if version:
suffix = self.generate_versioned_lib_info(env, [suffix, version], suffix, **kw2)
if Verbose:
print "_LibSuffixGenerator: return suffix=%r" % suffix
return suffix
ShLibSuffixGenerator = _LibSuffixGenerator('ShLib')
LdModSuffixGenerator = _LibSuffixGenerator('LdMod')
ImpLibSuffixGenerator = _LibSuffixGenerator('ImpLib')
class _LibSymlinkGenerator(_LibInfoGeneratorBase):
"""Library symlink map generator. It generates a list of symlinks that
should be created by SharedLibrary or LoadableModule builders"""
def __init__(self, libtype):
super(_LibSymlinkGenerator, self).__init__(libtype, 'Symlinks')
def __call__(self, env, libnode, **kw):
Verbose = False
if libnode and 'target' not in kw:
kw2 = kw.copy()
kw2['target'] = libnode
else:
kw2 = kw
if Verbose:
print "_LibSymLinkGenerator: libnode=%r" % libnode.get_path()
symlinks = None
version = self.get_lib_version(env, **kw2)
disable = self.get_lib_noversionsymlinks(env, **kw2)
if Verbose:
print '_LibSymlinkGenerator: version=%r' % version
print '_LibSymlinkGenerator: disable=%r' % disable
if version and not disable:
prefix = self.get_lib_prefix(env,**kw2)
suffix = self.get_lib_suffix(env,**kw2)
symlinks = self.generate_versioned_lib_info(env, [libnode, version, prefix, suffix], **kw2)
if Verbose:
print '_LibSymlinkGenerator: return symlinks=%r' % StringizeLibSymlinks(symlinks)
return symlinks
ShLibSymlinkGenerator = _LibSymlinkGenerator('ShLib')
LdModSymlinkGenerator = _LibSymlinkGenerator('LdMod')
ImpLibSymlinkGenerator = _LibSymlinkGenerator('ImpLib')
class _LibNameGenerator(_LibInfoGeneratorBase):
"""Generates "unmangled" library name from a library file node.
Generally, it's thought to revert modifications done by prefix/suffix
generators (_LibPrefixGenerator/_LibSuffixGenerator) used by a library
builder. For example, on gnulink the suffix generator used by SharedLibrary
builder appends $SHLIBVERSION to $SHLIBSUFFIX producing node name which
ends with "$SHLIBSUFFIX.$SHLIBVERSION". Correspondingly, the implementation
of _LibNameGenerator replaces "$SHLIBSUFFIX.$SHLIBVERSION" with
"$SHLIBSUFFIX" in the node's basename. So that, if $SHLIBSUFFIX is ".so",
$SHLIBVERSION is "0.1.2" and the node path is "/foo/bar/libfoo.so.0.1.2",
the _LibNameGenerator shall return "libfoo.so". Other link tools may
implement it's own way of library name unmangling.
"""
def __init__(self, libtype):
super(_LibNameGenerator, self).__init__(libtype, 'Name')
def __call__(self, env, libnode, **kw):
"""Returns "demangled" library name"""
Verbose = False
if libnode and 'target' not in kw:
kw2 = kw.copy()
kw2['target'] = libnode
else:
kw2 = kw
if Verbose:
print "_LibNameGenerator: libnode=%r" % libnode.get_path()
version = self.get_lib_version(env, **kw2)
if Verbose:
print '_LibNameGenerator: version=%r' % version
name = None
if version:
prefix = self.get_lib_prefix(env,**kw2)
suffix = self.get_lib_suffix(env,**kw2)
name = self.generate_versioned_lib_info(env, [libnode, version, prefix, suffix], **kw2)
if not name:
name = os.path.basename(libnode.get_path())
if Verbose:
print '_LibNameGenerator: return name=%r' % name
return name
ShLibNameGenerator = _LibNameGenerator('ShLib')
LdModNameGenerator = _LibNameGenerator('LdMod')
ImpLibNameGenerator = _LibNameGenerator('ImpLib')
class _LibSonameGenerator(_LibInfoGeneratorBase):
"""Library soname generator. Returns library soname (e.g. libfoo.so.0) for
a given node (e.g. /foo/bar/libfoo.so.0.1.2)"""
def __init__(self, libtype):
super(_LibSonameGenerator, self).__init__(libtype, 'Soname')
def __call__(self, env, libnode, **kw):
"""Returns a SONAME based on a shared library's node path"""
Verbose = False
if libnode and 'target' not in kw:
kw2 = kw.copy()
kw2['target'] = libnode
else:
kw2 = kw
if Verbose:
print "_LibSonameGenerator: libnode=%r" % libnode.get_path()
soname = _call_env_subst(env, '$SONAME', **kw2)
if not soname:
version = self.get_lib_version(env,**kw2)
if Verbose:
print "_LibSonameGenerator: version=%r" % version
if version:
prefix = self.get_lib_prefix(env,**kw2)
suffix = self.get_lib_suffix(env,**kw2)
soname = self.generate_versioned_lib_info(env, [libnode, version, prefix, suffix], **kw2)
if not soname:
# fallback to library name (as returned by appropriate _LibNameGenerator)
soname = _LibNameGenerator(self.get_libtype())(env, libnode)
if Verbose:
print "_LibSonameGenerator: FALLBACK: soname=%r" % soname
if Verbose:
print "_LibSonameGenerator: return soname=%r" % soname
return soname
ShLibSonameGenerator = _LibSonameGenerator('ShLib')
LdModSonameGenerator = _LibSonameGenerator('LdMod')
def StringizeLibSymlinks(symlinks):
"""Converts list with pairs of nodes to list with pairs of node paths
(strings). Used mainly for debugging."""
if SCons.Util.is_List(symlinks):
try:
return [ (k.get_path(), v.get_path()) for k,v in symlinks ]
except (TypeError, ValueError):
return symlinks
else:
return symlinks
def EmitLibSymlinks(env, symlinks, libnode, **kw):
"""Used by emitters to handle (shared/versioned) library symlinks"""
Verbose = False
# nodes involved in process... all symlinks + library
nodes = list(set([ x for x,y in symlinks ] + [libnode]))
clean_targets = kw.get('clean_targets', [])
if not SCons.Util.is_List(clean_targets):
clean_targets = [ clean_targets ]
for link, linktgt in symlinks:
env.SideEffect(link, linktgt)
if(Verbose):
print "EmitLibSymlinks: SideEffect(%r,%r)" % (link.get_path(), linktgt.get_path())
clean_list = filter(lambda x : x != linktgt, nodes)
env.Clean(list(set([linktgt] + clean_targets)), clean_list)
if(Verbose):
print "EmitLibSymlinks: Clean(%r,%r)" % (linktgt.get_path(), map(lambda x : x.get_path(), clean_list))
def CreateLibSymlinks(env, symlinks):
"""Physically creates symlinks. The symlinks argument must be a list in
form [ (link, linktarget), ... ], where link and linktarget are SCons
nodes.
"""
Verbose = False
for link, linktgt in symlinks:
linktgt = link.get_dir().rel_path(linktgt)
link = link.get_path()
if(Verbose):
print "CreateLibSymlinks: preparing to add symlink %r -> %r" % (link, linktgt)
# Delete the (previously created) symlink if exists. Let only symlinks
# to be deleted to prevent accidental deletion of source files...
if env.fs.islink(link):
env.fs.unlink(link)
if(Verbose):
print "CreateLibSymlinks: removed old symlink %r" % link
# If a file or directory exists with the same name as link, an OSError
# will be thrown, which should be enough, I think.
env.fs.symlink(linktgt, link)
if(Verbose):
print "CreateLibSymlinks: add symlink %r -> %r" % (link, linktgt)
return 0
def LibSymlinksActionFunction(target, source, env):
for tgt in target:
symlinks = getattr(getattr(tgt,'attributes', None), 'shliblinks', None)
if symlinks:
CreateLibSymlinks(env, symlinks)
return 0
def LibSymlinksStrFun(target, source, env, *args):
cmd = None
for tgt in target:
symlinks = getattr(getattr(tgt,'attributes', None), 'shliblinks', None)
if symlinks:
if cmd is None: cmd = ""
if cmd: cmd += "\n"
cmd += "Create symlinks for: %r" % tgt.get_path()
try:
linkstr = ', '.join([ "%r->%r" %(k,v) for k,v in StringizeLibSymlinks(symlinks)])
except (KeyError, ValueError):
pass
else:
cmd += ": %s" % linkstr
return cmd
LibSymlinksAction = SCons.Action.Action(LibSymlinksActionFunction, LibSymlinksStrFun)
def createSharedLibBuilder(env):
"""This is a utility function that creates the SharedLibrary
@ -393,11 +679,12 @@ def createSharedLibBuilder(env):
except KeyError:
import SCons.Defaults
action_list = [ SCons.Defaults.SharedCheck,
ShLibAction ]
SCons.Defaults.ShLinkAction,
LibSymlinksAction ]
shared_lib = SCons.Builder.Builder(action = action_list,
emitter = "$SHLIBEMITTER",
prefix = '$SHLIBPREFIX',
suffix = '$SHLIBSUFFIX',
prefix = ShLibPrefixGenerator,
suffix = ShLibSuffixGenerator,
target_scanner = ProgramScanner,
src_suffix = '$SHOBJSUFFIX',
src_builder = 'SharedObject')
@ -417,11 +704,12 @@ def createLoadableModuleBuilder(env):
except KeyError:
import SCons.Defaults
action_list = [ SCons.Defaults.SharedCheck,
SCons.Defaults.LdModuleLinkAction ]
SCons.Defaults.LdModuleLinkAction,
LibSymlinksAction ]
ld_module = SCons.Builder.Builder(action = action_list,
emitter = "$LDMODULEEMITTER",
prefix = '$LDMODULEPREFIX',
suffix = '$LDMODULESUFFIX',
prefix = LdModPrefixGenerator,
suffix = LdModSuffixGenerator,
target_scanner = ProgramScanner,
src_suffix = '$SHOBJSUFFIX',
src_builder = 'SharedObject')

View file

@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Tool/aixc++.py rel_2.4.0:3365:9259ea1c13d7 2015/09/21 14:03:43 bdbaddog"
__revision__ = "src/engine/SCons/Tool/aixc++.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
import os.path

Some files were not shown because too many files have changed in this diff Show more