Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Unified Diff: pylib/gyp/generator/ninja.py

Issue 9420031: Retrieve generator variables and use those for prefix/suffix, rather than repeating (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja_test.py » ('j') | pylib/gyp/generator/ninja_test.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/generator/ninja.py
===================================================================
--- pylib/gyp/generator/ninja.py (revision 1206)
+++ pylib/gyp/generator/ninja.py (working copy)
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import copy
import gyp
import gyp.common
import gyp.system_test
@@ -830,41 +831,29 @@
if not type:
type = spec['type']
+ default_variables = copy.copy(generator_default_variables)
+ CalculateVariables(default_variables, {'flavor': self.flavor})
+
# Compute filename prefix: the product prefix, or a default for
# the product type.
- if self.flavor == 'win':
- DEFAULT_PREFIX = {
- 'loadable_module': '',
- 'shared_library': '',
- 'static_library': '',
- }
- else:
- DEFAULT_PREFIX = {
- 'loadable_module': 'lib',
- 'shared_library': 'lib',
- 'static_library': 'lib',
- }
+ DEFAULT_PREFIX = {
+ 'loadable_module': default_variables['SHARED_LIB_PREFIX'],
+ 'shared_library': default_variables['SHARED_LIB_PREFIX'],
+ 'static_library': default_variables['STATIC_LIB_PREFIX'],
+ 'executable': default_variables['EXECUTABLE_PREFIX'],
+ }
prefix = spec.get('product_prefix', DEFAULT_PREFIX.get(type, ''))
# Compute filename extension: the product extension, or a default
# for the product type.
- if self.flavor == 'win':
- DEFAULT_EXTENSION = {
- 'static_library': 'lib',
- 'loadable_module': 'dll',
- 'shared_library': 'dll',
- 'executable': 'exe',
- }
- else:
- DEFAULT_EXTENSION = {
- 'static_library': 'a',
- 'loadable_module': 'so',
- 'shared_library': 'so',
- }
+ DEFAULT_EXTENSION = {
+ 'loadable_module': default_variables['SHARED_LIB_SUFFIX'],
+ 'shared_library': default_variables['SHARED_LIB_SUFFIX'],
+ 'static_library': default_variables['STATIC_LIB_SUFFIX'],
+ 'executable': default_variables['EXECUTABLE_SUFFIX'],
+ }
extension = spec.get('product_extension',
DEFAULT_EXTENSION.get(type, ''))
- if extension:
- extension = '.' + extension
if 'product_name' in spec:
# If we were given an explicit name, use that.
@@ -994,12 +983,12 @@
generator_extra_sources_for_rules = getattr(xcode_generator,
'generator_extra_sources_for_rules', [])
elif flavor == 'win':
- default_variables.setdefault('OS', 'win')
- default_variables.setdefault('EXECUTABLE_SUFFIX', '.exe')
- default_variables.setdefault('STATIC_LIB_PREFIX', '')
- default_variables.setdefault('STATIC_LIB_SUFFIX', '.lib')
- default_variables.setdefault('SHARED_LIB_PREFIX', '')
- default_variables.setdefault('SHARED_LIB_SUFFIX', '.dll')
+ default_variables['OS'] = 'win'
+ default_variables['EXECUTABLE_SUFFIX'] = '.exe'
+ default_variables['STATIC_LIB_PREFIX'] = ''
+ default_variables['STATIC_LIB_SUFFIX'] = '.lib'
+ default_variables['SHARED_LIB_PREFIX'] = ''
+ default_variables['SHARED_LIB_SUFFIX'] = '.dll'
else:
operating_system = flavor
if flavor == 'android':
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja_test.py » ('j') | pylib/gyp/generator/ninja_test.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698