Author: kgiusti Date: Fri Nov 2 16:30:25 2012 New Revision: 1405036 URL: http://svn.apache.org/viewvc?rev=1405036&view=rev Log: NO-JIRA: fixup the build to handle environment vars correctly
Added: qpid/proton/branches/kgiusti-msvc2010/proton-c/env.py (with props) Modified: qpid/proton/branches/kgiusti-msvc2010/proton-c/CMakeLists.txt qpid/proton/branches/kgiusti-msvc2010/proton-c/src/codec/encodings.h.py qpid/proton/branches/kgiusti-msvc2010/proton-c/src/protocol.h.py Modified: qpid/proton/branches/kgiusti-msvc2010/proton-c/CMakeLists.txt URL: http://svn.apache.org/viewvc/qpid/proton/branches/kgiusti-msvc2010/proton-c/CMakeLists.txt?rev=1405036&r1=1405035&r2=1405036&view=diff ============================================================================== --- qpid/proton/branches/kgiusti-msvc2010/proton-c/CMakeLists.txt (original) +++ qpid/proton/branches/kgiusti-msvc2010/proton-c/CMakeLists.txt Fri Nov 2 16:30:25 2012 @@ -83,13 +83,13 @@ include_directories ("${PROJECT_SOURCE_D add_custom_command ( OUTPUT ${PROJECT_BINARY_DIR}/encodings.h - COMMAND python ${PROJECT_SOURCE_DIR}/src/codec/encodings.h.py -s ${PROJECT_SOURCE_DIR} > ${PROJECT_BINARY_DIR}/encodings.h + COMMAND python ${PROJECT_SOURCE_DIR}/env.py PYTHONPATH=${PROJECT_SOURCE_DIR} python ${PROJECT_SOURCE_DIR}/src/codec/encodings.h.py > ${PROJECT_BINARY_DIR}/encodings.h DEPENDS ${PROJECT_SOURCE_DIR}/src/codec/encodings.h.py ) add_custom_command ( OUTPUT ${PROJECT_BINARY_DIR}/protocol.h - COMMAND python ${PROJECT_SOURCE_DIR}/src/protocol.h.py -s ${PROJECT_SOURCE_DIR} > ${PROJECT_BINARY_DIR}/protocol.h + COMMAND python ${PROJECT_SOURCE_DIR}/env.py PYTHONPATH=${PROJECT_SOURCE_DIR} python ${PROJECT_SOURCE_DIR}/src/protocol.h.py > ${PROJECT_BINARY_DIR}/protocol.h DEPENDS ${PROJECT_SOURCE_DIR}/src/protocol.h.py ) @@ -152,33 +152,22 @@ add_executable (proton-dump src/proton-d target_link_libraries (proton-dump qpid-proton) if (CMAKE_COMPILER_IS_GNUCC) - set (WARNING_FLAGS "-Wall -Werror -pedantic-errors") - set (CMAKE_C_FLAGS "${WARNING_FLAGS} -std=c99 -Iinclude -fPIC") - set (CMAKE_C_FLAGS_DEBUG "-O -g") - set (CMAKE_C_FLAGS_RELEASE "-O2 -g -DNDEBUG") - set (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") + set (PN_EXTRA_C_FLAGS "-Wall -Werror -pedantic-errors -std=c99 -g -Iinclude -fPIC") endif (CMAKE_COMPILER_IS_GNUCC) -if (MSVC) - set (WARNING_FLAGS "/Wall") - set (CMAKE_C_FLAGS "${WARNING_FLAGS} /Iinclude") - set (CMAKE_C_FLAGS_DEBUG "/MDd /Od /Zi") - set (CMAKE_C_FLAGS_RELEASE "/MD /Ox /D NDEBUG") - set (CMAKE_C_FLAGS_RELWITHDEBINFO "/MD /Ox /Zi") -endif (MSVC) - set_target_properties ( qpid-proton PROPERTIES + COMPILE_FLAGS ${PN_EXTRA_C_FLAGS} VERSION ${PN_VERSION} SOVERSION ${PN_SOVERSION} ) -# set_target_properties ( -# proton proton-dump -# PROPERTIES -# COMPILE_FLAGS "-Wall -Werror -pedantic-errors -std=c99 -g -Iinclude -fPIC" -# ) +set_target_properties ( + proton proton-dump + PROPERTIES + COMPILE_FLAGS ${PN_EXTRA_C_FLAGS} +) # Install executables and libraries install (TARGETS proton proton-dump qpid-proton Added: qpid/proton/branches/kgiusti-msvc2010/proton-c/env.py URL: http://svn.apache.org/viewvc/qpid/proton/branches/kgiusti-msvc2010/proton-c/env.py?rev=1405036&view=auto ============================================================================== --- qpid/proton/branches/kgiusti-msvc2010/proton-c/env.py (added) +++ qpid/proton/branches/kgiusti-msvc2010/proton-c/env.py Fri Nov 2 16:30:25 2012 @@ -0,0 +1,64 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# +# A platform-agnostic tool for running a program in a modified environment. +# + +import sys +import os +from optparse import OptionParser + +def main(argv=None): + + parser = OptionParser(usage="Usage: %prog [options] [--] VAR=VALUE... command [options] arg1 arg2...") + parser.add_option("-i", "--ignore-environment", + action="store_true", default=False, + help="Start with an empty environment (do not inherit current environment)") + + (options, args) = parser.parse_args(args=argv) + + if options.ignore_environment: + new_env = {} + else: + new_env = os.environ.copy() + + # pull out each name value pair + while (len(args)): + z = args[0].split("=",1) + if len(z) != 2: + break; # done with env args + if len(z[0]) == 0: + raise Exception("Error: incorrect format for env var: '%s'" % str(args[x])) + del args[0] + if len(z[1]) == 0: + # value is not present, so delete it + if z[0] in new_env: + del new_env[z[0]] + else: + new_env[z[0]] = z[1] + + if len(args) == 0 or len(args[0]) == 0: + raise Exception("Error: syntax error in command arguments") + + os.execvpe(args[0], args, new_env) + return 0 + +if __name__ == "__main__": + sys.exit(main()) Propchange: qpid/proton/branches/kgiusti-msvc2010/proton-c/env.py ------------------------------------------------------------------------------ svn:eol-style = native Modified: qpid/proton/branches/kgiusti-msvc2010/proton-c/src/codec/encodings.h.py URL: http://svn.apache.org/viewvc/qpid/proton/branches/kgiusti-msvc2010/proton-c/src/codec/encodings.h.py?rev=1405036&r1=1405035&r2=1405036&view=diff ============================================================================== --- qpid/proton/branches/kgiusti-msvc2010/proton-c/src/codec/encodings.h.py (original) +++ qpid/proton/branches/kgiusti-msvc2010/proton-c/src/codec/encodings.h.py Fri Nov 2 16:30:25 2012 @@ -18,17 +18,7 @@ # under the License. # -import optparse, os, sys - -parser = optparse.OptionParser(usage="usage: %prog [options]") -parser.add_option("-s", "--srcpath", action="store", type="string", - help="Path to the top of the source tree.") -opts, outfile = parser.parse_args() # uses sys.argv[1:] - -if opts.srcpath: - sys.path.append( opts.srcpath ) - -import mllib +import mllib, optparse, os, sys xml = os.path.join(os.path.dirname(__file__), "types.xml") doc = mllib.xml_parse(xml) Modified: qpid/proton/branches/kgiusti-msvc2010/proton-c/src/protocol.h.py URL: http://svn.apache.org/viewvc/qpid/proton/branches/kgiusti-msvc2010/proton-c/src/protocol.h.py?rev=1405036&r1=1405035&r2=1405036&view=diff ============================================================================== --- qpid/proton/branches/kgiusti-msvc2010/proton-c/src/protocol.h.py (original) +++ qpid/proton/branches/kgiusti-msvc2010/proton-c/src/protocol.h.py Fri Nov 2 16:30:25 2012 @@ -18,16 +18,6 @@ # under the License. # -import optparse, sys - -parser = optparse.OptionParser(usage="usage: %prog [options]") -parser.add_option("-s", "--srcpath", action="store", type="string", - help="Path to the top of the source tree.") -opts, outfile = parser.parse_args() # uses sys.argv[1:] - -if opts.srcpath: - sys.path.append( opts.srcpath ) - from protocol import * print "/* generated */" --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org