and platform != 'win32' and platform != 'win64'): print 'Unsupported target \"' + platform + '\"' sys.exit(1) # script directory script_dir = os.path.dirname(__file__) # JCEF root directory jcef_dir = os.path.abspath(os.path.join(script_dir, os.pardir)) # Read and parse the CEF version file. args = {} read_readme_file(os.path.join(jcef_dir, 'jcef_build', 'README.txt'), args) # retrieve url and revision information for CEF if not git.is_checkout(jcef_dir): raise Exception('Not a valid checkout: %s' % (jcef_dir)) jcef_commit_number = git.get_commit_number(jcef_dir) jcef_commit_hash = git.get_hash(jcef_dir) jcef_url = git.get_url(jcef_dir) jcef_ver = '%s.%s.%s.%s+g%s' % (args['CEF_MAJOR'], args['CEF_MINOR'], args['CEF_PATCH'], jcef_commit_number, jcef_commit_hash[:7]) date = get_date() cef_ver = args['CEF_VER'] cef_url = args['CEF_URL'] chromium_ver = args['CHROMIUM_VER'] chromium_url = args['CHROMIUM_URL']
def write_svn_header(header): """ Creates the header file for the current revision if the information has changed or if the file doesn't already exist. """ if path_exists(header): oldcontents = read_file(header) else: oldcontents = '' if not git.is_checkout(jcef_dir): raise Exception('Not a valid checkout') commit_number = git.get_commit_number(jcef_dir) commit_hash = git.get_hash(jcef_dir) year = get_year() # Read and parse the CEF version file. args = {} read_readme_file(os.path.join(options.cefpath, 'README.txt'), args) version = '%s.%s.%s.g%s' % (args['CEF_MAJOR'], args['CEF_BUILD'], commit_number, commit_hash[:7]) newcontents = '// Copyright (c) '+year+' The Chromium Embedded Framework Authors. All rights\n'+\ '// reserved. Use of this source code is governed by a BSD-style license that\n'+\ '// can be found in the LICENSE file.\n'+\ '//\n'+\ '// Redistribution and use in source and binary forms, with or without\n'+\ '// modification, are permitted provided that the following conditions are\n'+\ '// met:\n'+\ '//\n'+\ '// * Redistributions of source code must retain the above copyright\n'+\ '// notice, this list of conditions and the following disclaimer.\n'+\ '// * Redistributions in binary form must reproduce the above\n'+\ '// copyright notice, this list of conditions and the following disclaimer\n'+\ '// in the documentation and/or other materials provided with the\n'+\ '// distribution.\n'+\ '// * Neither the name of Google Inc. nor the name Chromium Embedded\n'+\ '// Framework nor the names of its contributors may be used to endorse\n'+\ '// or promote products derived from this software without specific prior\n'+\ '// written permission.\n'+\ '//\n'+\ '// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n'+\ '// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n'+\ '// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n'+\ '// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n'+\ '// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n'+\ '// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n'+\ '// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n'+\ '// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n'+\ '// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n'+\ '// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n'+\ '// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n'+\ '//\n'+\ '// ---------------------------------------------------------------------------\n'+\ '//\n'+\ '// This file is generated by the make_version_header.py tool.\n'+\ '//\n\n'+\ '#ifndef JCEF_INCLUDE_JCEF_VERSION_H_\n'+\ '#define JCEF_INCLUDE_JCEF_VERSION_H_\n\n'+\ '#define JCEF_VERSION "' + version + '"\n'+\ '#define JCEF_COMMIT_NUMBER ' + commit_number + '\n'+\ '#define JCEF_COMMIT_HASH "' + commit_hash + '"\n'+\ '#define JCEF_COPYRIGHT_YEAR ' + year + '\n\n'+\ '#define DO_MAKE_STRING(p) #p\n'+\ '#define MAKE_STRING(p) DO_MAKE_STRING(p)\n\n'+\ '#endif // JCEF_INCLUDE_JCEF_VERSION_H_\n' if newcontents != oldcontents: write_file(header, newcontents) return True return False
sys.exit() if not options.ninjabuild: print 'Ninja build is required on all platforms' sys.exit() # script directory script_dir = os.path.dirname(__file__) # CEF root directory cef_dir = os.path.abspath(os.path.join(script_dir, os.pardir)) # src directory src_dir = os.path.abspath(os.path.join(cef_dir, os.pardir)) if not git.is_checkout(cef_dir): raise Exception('Not a valid checkout: %s' % (cef_dir)) # retrieve information for CEF cef_url = git.get_url(cef_dir) cef_rev = git.get_hash(cef_dir) cef_commit_number = git.get_commit_number(cef_dir) if not git.is_checkout(src_dir): raise Exception('Not a valid checkout: %s' % (src_dir)) # retrieve information for Chromium chromium_url = git.get_url(src_dir) chromium_rev = git.get_hash(src_dir) date = get_date()
platform != 'win32' and platform != 'win64'): print 'Unsupported target \"'+platform+'\"' sys.exit() # script directory script_dir = os.path.dirname(__file__) # JCEF root directory jcef_dir = os.path.abspath(os.path.join(script_dir, os.pardir, os.pardir)) # Read and parse the CEF version file. args = {} read_readme_file(os.path.join(jcef_dir, 'src/third_party/cef/'+platform+'/README.txt'), args) # retrieve url and revision information for CEF if not git.is_checkout(jcef_dir): raise Exception('Not a valid checkout: %s' % (cef_dir)) jcef_commit_number = git.get_commit_number(jcef_dir) jcef_commit_hash = git.get_hash(jcef_dir) jcef_url = git.get_url(jcef_dir) jcef_ver = '%s.%s.%s.g%s' % (args['CEF_MAJOR'], args['CEF_BUILD'], jcef_commit_number, jcef_commit_hash[:7]) date = get_date() cef_ver = args['CEF_VER'] cef_url = args['CEF_URL'] chromium_ver = args['CHROMIUM_VER'] chromium_url = args['CHROMIUM_URL'] # create the README.TXT file
# Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights # reserved. Use of this source code is governed by a BSD-style license that # can be found in the LICENSE file. import git_util as git import os import sys # cannot be loaded as a module if __name__ != "__main__": sys.stderr.write('This file cannot be loaded as a module!') sys.exit() if len(sys.argv) < 2: raise Exception('Path expected on command-line') path = sys.argv[1] if git.is_checkout(path): sys.stdout.write(git.get_commit_number(path)) else: raise Exception('Not a valid checkout: ' + path)
# script directory script_dir = os.path.dirname(__file__) # CEF root directory cef_dir = os.path.abspath(os.path.join(script_dir, os.pardir)) # src directory src_dir = os.path.abspath(os.path.join(cef_dir, os.pardir)) # retrieve url and revision information for CEF if svn.is_checkout(cef_dir): cef_info = svn.get_svn_info(cef_dir) cef_url = cef_info['url'] cef_rev = cef_info['revision'] elif git.is_checkout(cef_dir): cef_url = git.get_url(cef_dir) cef_rev = git.get_svn_revision(cef_dir) else: raise Exception('Not a valid checkout: %s' % (cef_dir)) # retrieve url and revision information for Chromium if svn.is_checkout(src_dir): chromium_info = svn.get_svn_info(src_dir) chromium_url = chromium_info['url'] chromium_rev = chromium_info['revision'] elif git.is_checkout(src_dir): chromium_url = git.get_url(src_dir) chromium_rev = git.get_hash(src_dir) else: raise Exception('Not a valid checkout: %s' % (src_dir))
# Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights # reserved. Use of this source code is governed by a BSD-style license that # can be found in the LICENSE file. import git_util as git import os import sys # cannot be loaded as a module if __name__ != "__main__": sys.stderr.write('This file cannot be loaded as a module!') sys.exit() if git.is_checkout('.'): sys.stdout.write(git.get_commit_number()) else: raise Exception('Not a valid checkout')
# script directory script_dir = os.path.dirname(__file__) # CEF root directory jcef_dir = os.path.abspath(os.path.join(script_dir, os.pardir)) # src directory src_dir = os.path.abspath(os.path.join(jcef_dir, os.pardir)) # retrieve url and revision information for CEF if svn.is_checkout(jcef_dir) or svn.is_checkout(src_dir): jcef_info = svn.get_svn_info(jcef_dir) jcef_url = jcef_info['url'] jcef_rev = jcef_info['revision'] elif git.is_checkout(jcef_dir) or git.is_checkout(src_dir): jcef_url = git.get_url(jcef_dir) jcef_rev = git.get_svn_revision(jcef_dir) else: raise Exception('Not a valid checkout: %s' % (cef_dir)) date = get_date() # Read and parse the version file (key=value pairs, one per line) args = {} read_readme_file( os.path.join(jcef_dir, 'third_party/cef/' + platform + '/README.txt'), args) jcef_ver = args['CEF_VER'] + '.' + jcef_rev cef_ver = args['CEF_VER']
def write_version_header(header): """ Creates the header file for the current revision and Chrome version information if the information has changed or if the file doesn't already exist. """ if not git.is_checkout('.'): raise Exception('Not a valid checkout') if path_exists(header): oldcontents = read_file(header) else: oldcontents = '' year = get_year() formatter = VersionFormatter() commit_hash = formatter.get_cef_commit_components()['HASH'] commit_number = formatter.get_cef_commit_components()['NUMBER'] version = formatter.get_version_string() version_parts = formatter.get_version_parts() chrome = formatter.get_chrome_version_components() version_defines = '#define CEF_VERSION "%s"\n' % version for key in ('MAJOR', 'MINOR', 'PATCH'): version_defines += '#define CEF_VERSION_%s %d\n' % (key, version_parts[key]) newcontents = '// Copyright (c) '+year+' Marshall A. Greenblatt. All rights reserved.\n'+\ '//\n'+\ '// Redistribution and use in source and binary forms, with or without\n'+\ '// modification, are permitted provided that the following conditions are\n'+\ '// met:\n'+\ '//\n'+\ '// * Redistributions of source code must retain the above copyright\n'+\ '// notice, this list of conditions and the following disclaimer.\n'+\ '// * Redistributions in binary form must reproduce the above\n'+\ '// copyright notice, this list of conditions and the following disclaimer\n'+\ '// in the documentation and/or other materials provided with the\n'+\ '// distribution.\n'+\ '// * Neither the name of Google Inc. nor the name Chromium Embedded\n'+\ '// Framework nor the names of its contributors may be used to endorse\n'+\ '// or promote products derived from this software without specific prior\n'+\ '// written permission.\n'+\ '//\n'+\ '// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n'+\ '// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n'+\ '// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n'+\ '// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n'+\ '// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n'+\ '// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n'+\ '// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n'+\ '// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n'+\ '// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n'+\ '// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n'+\ '// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n'+\ '//\n'+\ '// ---------------------------------------------------------------------------\n'+\ '//\n'+\ '// This file is generated by the make_version_header.py tool.\n'+\ '//\n\n'+\ '#ifndef CEF_INCLUDE_CEF_VERSION_H_\n'+\ '#define CEF_INCLUDE_CEF_VERSION_H_\n\n'+\ version_defines+\ '#define CEF_COMMIT_NUMBER ' + commit_number + '\n'+\ '#define CEF_COMMIT_HASH "' + commit_hash + '"\n'+\ '#define COPYRIGHT_YEAR ' + year + '\n\n'+\ '#define CHROME_VERSION_MAJOR ' + chrome['MAJOR'] + '\n'+\ '#define CHROME_VERSION_MINOR ' + chrome['MINOR'] + '\n'+\ '#define CHROME_VERSION_BUILD ' + chrome['BUILD'] + '\n'+\ '#define CHROME_VERSION_PATCH ' + chrome['PATCH'] + '\n\n'+\ '#define DO_MAKE_STRING(p) #p\n'+\ '#define MAKE_STRING(p) DO_MAKE_STRING(p)\n\n'+\ '#ifndef APSTUDIO_HIDDEN_SYMBOLS\n\n'\ '#include "include/internal/cef_export.h"\n\n'+\ '#ifdef __cplusplus\n'+\ 'extern "C" {\n'+\ '#endif\n\n'+\ '// Returns CEF version information for the libcef library. The |entry|\n'+\ '// parameter describes which version component will be returned:\n'+\ '// 0 - CEF_VERSION_MAJOR\n'+\ '// 1 - CEF_VERSION_MINOR\n'+\ '// 2 - CEF_VERSION_PATCH\n'+\ '// 3 - CEF_COMMIT_NUMBER\n'+\ '// 4 - CHROME_VERSION_MAJOR\n'+\ '// 5 - CHROME_VERSION_MINOR\n'+\ '// 6 - CHROME_VERSION_BUILD\n'+\ '// 7 - CHROME_VERSION_PATCH\n'+\ '///\n'+\ 'CEF_EXPORT int cef_version_info(int entry);\n\n'+\ '#ifdef __cplusplus\n'+\ '}\n'+\ '#endif\n\n'+\ '#endif // APSTUDIO_HIDDEN_SYMBOLS\n\n'+\ '#endif // CEF_INCLUDE_CEF_VERSION_H_\n' if newcontents != oldcontents: write_file(header, newcontents) return True return False
# Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights # reserved. Use of this source code is governed by a BSD-style license that # can be found in the LICENSE file. import git_util as git import os import sys # cannot be loaded as a module if __name__ != "__main__": sys.stderr.write("This file cannot be loaded as a module!") sys.exit() if git.is_checkout("."): sys.stdout.write(git.get_commit_number()) else: raise Exception("Not a valid checkout")
def make_version_header(header): if not git.is_checkout('.'): raise Exception('Not a valid checkout') result = get_copyright(full=True, translator=False) + \ """// // --------------------------------------------------------------------------- // // This file was generated by the make_version_header.py tool. // #ifndef CEF_INCLUDE_CEF_VERSION_H_ #define CEF_INCLUDE_CEF_VERSION_H_ #define CEF_VERSION "$VERSION$" #define CEF_VERSION_MAJOR $VERSION_MAJOR$ #define CEF_VERSION_MINOR $VERSION_MINOR$ #define CEF_VERSION_PATCH $VERSION_PATCH$ #define CEF_COMMIT_NUMBER $COMMIT_NUMBER$ #define CEF_COMMIT_HASH "$COMMIT_HASH$" #define COPYRIGHT_YEAR $YEAR$ #define CHROME_VERSION_MAJOR $CHROME_MAJOR$ #define CHROME_VERSION_MINOR $CHROME_MINOR$ #define CHROME_VERSION_BUILD $CHROME_BUILD$ #define CHROME_VERSION_PATCH $CHROME_PATCH$ #define DO_MAKE_STRING(p) #p #define MAKE_STRING(p) DO_MAKE_STRING(p) #ifndef APSTUDIO_HIDDEN_SYMBOLS #include "include/internal/cef_export.h" #ifdef __cplusplus extern "C" { #endif // Returns CEF version information for the libcef library. The |entry| // parameter describes which version component will be returned: // 0 - CEF_VERSION_MAJOR // 1 - CEF_VERSION_MINOR // 2 - CEF_VERSION_PATCH // 3 - CEF_COMMIT_NUMBER // 4 - CHROME_VERSION_MAJOR // 5 - CHROME_VERSION_MINOR // 6 - CHROME_VERSION_BUILD // 7 - CHROME_VERSION_PATCH /// CEF_EXPORT int cef_version_info(int entry); #ifdef __cplusplus } #endif #endif // APSTUDIO_HIDDEN_SYMBOLS #endif // CEF_INCLUDE_CEF_VERSION_H_ """ formatter = VersionFormatter() # Substitute hash values for placeholders. result = result.replace('$YEAR$', get_year()) result = result.replace('$VERSION$', formatter.get_version_string()) commit_components = formatter.get_cef_commit_components() for key in ('HASH', 'NUMBER'): result = result.replace('$COMMIT_%s$' % key, str(commit_components[key])) version_parts = formatter.get_version_parts() for key in ('MAJOR', 'MINOR', 'PATCH'): result = result.replace('$VERSION_%s$' % key, str(version_parts[key])) chrome_version_components = formatter.get_chrome_version_components() for key in ('MAJOR', 'MINOR', 'BUILD', 'PATCH'): result = result.replace('$CHROME_%s$' % key, str(chrome_version_components[key])) return result
parser.add_option( '--resave', action='store_true', dest='resave', default=False, help='re-save existing patch files to pick up manual changes') (options, args) = parser.parse_args() # The CEF root directory is the parent directory of _this_ script. cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) src_dir = os.path.join(cef_dir, os.pardir) # Determine the type of Chromium checkout. if svn.is_checkout(src_dir): src_is_git = False elif git.is_checkout(src_dir): src_is_git = True else: raise Exception('Not a valid checkout: %s' % src_dir) patch_dir = os.path.join(cef_dir, 'patch') patch_cfg = os.path.join(patch_dir, 'patch.cfg') if not os.path.isfile(patch_cfg): raise Exception('File does not exist: %s' % patch_cfg) # Read the patch configuration file. msg('Reading patch config %s' % patch_cfg) scope = {} execfile(patch_cfg, scope) patches = scope["patches"]
def write_svn_header(header, chrome_version, cef_version, cpp_header_dir): """ Creates the header file for the current revision and Chrome version information if the information has changed or if the file doesn't already exist. """ if not path_exists(chrome_version): raise Exception("Chrome version file " + chrome_version + " does not exist.") if not path_exists(cef_version): raise Exception("CEF version file " + cef_version + " does not exist.") args = {} read_version_file(chrome_version, args) read_version_file(cef_version, args) if path_exists(header): oldcontents = read_file(header) else: oldcontents = "" year = get_year() if svn.is_checkout("."): revision = svn.get_revision() elif git.is_checkout("."): revision = git.get_svn_revision() else: raise Exception("Not a valid checkout") # calculate api hashes api_hash_calculator = cef_api_hash(cpp_header_dir, verbose=False) api_hashes = api_hash_calculator.calculate() newcontents = ( "// Copyright (c) " + year + " Marshall A. Greenblatt. All rights reserved.\n" + "//\n" + "// Redistribution and use in source and binary forms, with or without\n" + "// modification, are permitted provided that the following conditions are\n" + "// met:\n" + "//\n" + "// * Redistributions of source code must retain the above copyright\n" + "// notice, this list of conditions and the following disclaimer.\n" + "// * Redistributions in binary form must reproduce the above\n" + "// copyright notice, this list of conditions and the following disclaimer\n" + "// in the documentation and/or other materials provided with the\n" + "// distribution.\n" + "// * Neither the name of Google Inc. nor the name Chromium Embedded\n" + "// Framework nor the names of its contributors may be used to endorse\n" + "// or promote products derived from this software without specific prior\n" + "// written permission.\n" + "//\n" + "// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" + '// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n' + "// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n" + "// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n" + "// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n" + "// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n" + "// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" + "// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n" + "// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" + "// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n" + "// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + "//\n" + "// ---------------------------------------------------------------------------\n" + "//\n" + "// This file is generated by the make_version_header.py tool.\n" + "//\n\n" + "#ifndef CEF_INCLUDE_CEF_VERSION_H_\n" + "#define CEF_INCLUDE_CEF_VERSION_H_\n\n" + "#define CEF_VERSION_MAJOR " + args["CEF_MAJOR"] + "\n" + "#define CEF_REVISION " + revision + "\n" + "#define COPYRIGHT_YEAR " + year + "\n\n" + "#define CHROME_VERSION_MAJOR " + args["MAJOR"] + "\n" + "#define CHROME_VERSION_MINOR " + args["MINOR"] + "\n" + "#define CHROME_VERSION_BUILD " + args["BUILD"] + "\n" + "#define CHROME_VERSION_PATCH " + args["PATCH"] + "\n\n" + "#define DO_MAKE_STRING(p) #p\n" + "#define MAKE_STRING(p) DO_MAKE_STRING(p)\n\n" + "#ifndef APSTUDIO_HIDDEN_SYMBOLS\n\n" '#include "include/internal/cef_export.h"\n\n' + "#ifdef __cplusplus\n" + 'extern "C" {\n' + "#endif\n\n" + "// The API hash is created by analyzing CEF header files for C API type\n" + "// definitions. The hash value will change when header files are modified\n" + "// in a way that may cause binary incompatibility with other builds. The\n" + "// universal hash value will change if any platform is affected whereas the\n" + "// platform hash values will change only if that particular platform is\n" + "// affected.\n" + '#define CEF_API_HASH_UNIVERSAL "' + api_hashes["universal"] + '"\n' + "#if defined(OS_WIN)\n" + '#define CEF_API_HASH_PLATFORM "' + api_hashes["windows"] + '"\n' + "#elif defined(OS_MACOSX)\n" + '#define CEF_API_HASH_PLATFORM "' + api_hashes["macosx"] + '"\n' + "#elif defined(OS_LINUX)\n" + '#define CEF_API_HASH_PLATFORM "' + api_hashes["linux"] + '"\n' + "#endif\n\n" + "///\n" + "// Returns the CEF build revision for the libcef library.\n" + "///\n" + "CEF_EXPORT int cef_build_revision();\n\n" + "///\n" + "// Returns CEF version information for the libcef library. The |entry|\n" + "// parameter describes which version component will be returned:\n" + "// 0 - CEF_VERSION_MAJOR\n" + "// 1 - CEF_REVISION\n" + "// 2 - CHROME_VERSION_MAJOR\n" + "// 3 - CHROME_VERSION_MINOR\n" + "// 4 - CHROME_VERSION_BUILD\n" + "// 5 - CHROME_VERSION_PATCH\n" + "///\n" + "CEF_EXPORT int cef_version_info(int entry);\n\n" + "///\n" + "// Returns CEF API hashes for the libcef library. The returned string is owned\n" + "// by the library and should not be freed. The |entry| parameter describes which\n" + "// hash value will be returned:\n" + "// 0 - CEF_API_HASH_PLATFORM\n" + "// 1 - CEF_API_HASH_UNIVERSAL\n" + "///\n" + "CEF_EXPORT const char* cef_api_hash(int entry);\n\n" + "#ifdef __cplusplus\n" + "}\n" + "#endif\n\n" + "#endif // APSTUDIO_HIDDEN_SYMBOLS\n\n" + "#endif // CEF_INCLUDE_CEF_VERSION_H_\n" ) if newcontents != oldcontents: write_file(header, newcontents) return True return False
""" parser = OptionParser(description=disc) parser.add_option('--resave', action='store_true', dest='resave', default=False, help='re-save existing patch files to pick up manual changes') (options, args) = parser.parse_args() # The CEF root directory is the parent directory of _this_ script. cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) src_dir = os.path.join(cef_dir, os.pardir) # Determine the type of Chromium checkout. if svn.is_checkout(src_dir): src_is_git = False elif git.is_checkout(src_dir): src_is_git = True else: raise Exception('Not a valid checkout: %s' % src_dir) patch_dir = os.path.join(cef_dir, 'patch') patch_cfg = os.path.join(patch_dir, 'patch.cfg') if not os.path.isfile(patch_cfg): raise Exception('File does not exist: %s' % patch_cfg) # Read the patch configuration file. msg('Reading patch config %s' % patch_cfg) scope = {} execfile(patch_cfg, scope) patches = scope["patches"]
def write_svn_header(header, chrome_version, cef_version, cpp_header_dir): """ Creates the header file for the current revision and Chrome version information if the information has changed or if the file doesn't already exist. """ if not path_exists(chrome_version): raise Exception('Chrome version file '+chrome_version+' does not exist.') if not path_exists(cef_version): raise Exception('CEF version file '+cef_version+' does not exist.') args = {} read_version_file(chrome_version, args) read_version_file(cef_version, args) if path_exists(header): oldcontents = read_file(header) else: oldcontents = '' year = get_year() if svn.is_checkout('.'): revision = svn.get_revision() elif git.is_checkout('.'): revision = git.get_svn_revision() else: raise Exception('Not a valid checkout') # calculate api hashes api_hash_calculator = cef_api_hash(cpp_header_dir, verbose = False) api_hashes = api_hash_calculator.calculate() newcontents = '// Copyright (c) '+year+' Marshall A. Greenblatt. All rights reserved.\n'+\ '//\n'+\ '// Redistribution and use in source and binary forms, with or without\n'+\ '// modification, are permitted provided that the following conditions are\n'+\ '// met:\n'+\ '//\n'+\ '// * Redistributions of source code must retain the above copyright\n'+\ '// notice, this list of conditions and the following disclaimer.\n'+\ '// * Redistributions in binary form must reproduce the above\n'+\ '// copyright notice, this list of conditions and the following disclaimer\n'+\ '// in the documentation and/or other materials provided with the\n'+\ '// distribution.\n'+\ '// * Neither the name of Google Inc. nor the name Chromium Embedded\n'+\ '// Framework nor the names of its contributors may be used to endorse\n'+\ '// or promote products derived from this software without specific prior\n'+\ '// written permission.\n'+\ '//\n'+\ '// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n'+\ '// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n'+\ '// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n'+\ '// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n'+\ '// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n'+\ '// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n'+\ '// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n'+\ '// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n'+\ '// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n'+\ '// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n'+\ '// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n'+\ '//\n'+\ '// ---------------------------------------------------------------------------\n'+\ '//\n'+\ '// This file is generated by the make_version_header.py tool.\n'+\ '//\n\n'+\ '#ifndef CEF_INCLUDE_CEF_VERSION_H_\n'+\ '#define CEF_INCLUDE_CEF_VERSION_H_\n\n'+\ '#define CEF_VERSION_MAJOR ' + args['CEF_MAJOR'] + '\n'+\ '#define CEF_REVISION ' + revision + '\n'+\ '#define COPYRIGHT_YEAR ' + year + '\n\n'+\ '#define CHROME_VERSION_MAJOR ' + args['MAJOR'] + '\n'+\ '#define CHROME_VERSION_MINOR ' + args['MINOR'] + '\n'+\ '#define CHROME_VERSION_BUILD ' + args['BUILD'] + '\n'+\ '#define CHROME_VERSION_PATCH ' + args['PATCH'] + '\n\n'+\ '#define DO_MAKE_STRING(p) #p\n'+\ '#define MAKE_STRING(p) DO_MAKE_STRING(p)\n\n'+\ '#ifndef APSTUDIO_HIDDEN_SYMBOLS\n\n'\ '#ifdef __cplusplus\n'+\ 'extern "C" {\n'+\ '#endif\n\n'+\ '#include "internal/cef_export.h"\n\n'+\ '// The API hash is created by analyzing CEF header files for C API type\n'+\ '// definitions. The hash value will change when header files are modified\n'+\ '// in a way that may cause binary incompatibility with other builds. The\n'+\ '// universal hash value will change if any platform is affected whereas the\n'+\ '// platform hash values will change only if that particular platform is\n'+\ '// affected.\n'+\ '#define CEF_API_HASH_UNIVERSAL "' + api_hashes['universal'] + '"\n'+\ '#if defined(OS_WIN)\n'+\ '#define CEF_API_HASH_PLATFORM "' + api_hashes['windows'] + '"\n'+\ '#elif defined(OS_MACOSX)\n'+\ '#define CEF_API_HASH_PLATFORM "' + api_hashes['macosx'] + '"\n'+\ '#elif defined(OS_LINUX)\n'+\ '#define CEF_API_HASH_PLATFORM "' + api_hashes['linux'] + '"\n'+\ '#endif\n\n'+\ '///\n'+\ '// Returns the CEF build revision for the libcef library.\n'+\ '///\n'+\ 'CEF_EXPORT int cef_build_revision();\n\n'+\ '///\n'+\ '// Returns CEF version information for the libcef library. The |entry|\n'+\ '// parameter describes which version component will be returned:\n'+\ '// 0 - CEF_VERSION_MAJOR\n'+\ '// 1 - CEF_REVISION\n'+\ '// 2 - CHROME_VERSION_MAJOR\n'+\ '// 3 - CHROME_VERSION_MINOR\n'+\ '// 4 - CHROME_VERSION_BUILD\n'+\ '// 5 - CHROME_VERSION_PATCH\n'+\ '///\n'+\ 'CEF_EXPORT int cef_version_info(int entry);\n\n'+\ '///\n'+\ '// Returns CEF API hashes for the libcef library. The returned string is owned\n'+\ '// by the library and should not be freed. The |entry| parameter describes which\n'+\ '// hash value will be returned:\n'+\ '// 0 - CEF_API_HASH_PLATFORM\n'+\ '// 1 - CEF_API_HASH_UNIVERSAL\n'+\ '///\n'+\ 'CEF_EXPORT const char* cef_api_hash(int entry);\n\n'+\ '#ifdef __cplusplus\n'+\ '}\n'+\ '#endif\n\n'+\ '#endif // APSTUDIO_HIDDEN_SYMBOLS\n\n'+\ '#endif // CEF_INCLUDE_CEF_VERSION_H_\n' if newcontents != oldcontents: write_file(header, newcontents) return True return False
# script directory script_dir = os.path.dirname(__file__) # CEF root directory jcef_dir = os.path.abspath(os.path.join(script_dir, os.pardir)) # src directory src_dir = os.path.abspath(os.path.join(jcef_dir, os.pardir)) # retrieve url and revision information for CEF if svn.is_checkout(jcef_dir) or svn.is_checkout(src_dir): jcef_info = svn.get_svn_info(jcef_dir) jcef_url = jcef_info['url'] jcef_rev = jcef_info['revision'] elif git.is_checkout(jcef_dir) or git.is_checkout(src_dir): jcef_url = git.get_url(jcef_dir) jcef_rev = git.get_svn_revision(jcef_dir) else: raise Exception('Not a valid checkout: %s' % (cef_dir)) date = get_date() # Read and parse the version file (key=value pairs, one per line) args = {} read_readme_file(os.path.join(jcef_dir, 'third_party/cef/'+platform+'/README.txt'), args) jcef_ver = args['CEF_VER']+'.'+jcef_rev cef_ver = args['CEF_VER'] cef_url = args['CEF_URL'] chromium_ver = args['CHROMIUM_VER']