commit
9893cd2f23
16
.gitignore
vendored
16
.gitignore
vendored
@ -14,16 +14,18 @@
|
|||||||
# Python
|
# Python
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|
||||||
# astyle-specific files and folders
|
# Compiled Doxygen documentation
|
||||||
/AStyle
|
/doxygen/html
|
||||||
|
|
||||||
# For projects that use Waf for building: http://code.google.com/p/waf/
|
# Waf files
|
||||||
waf-*
|
waf-*
|
||||||
|
waf3-*
|
||||||
.waf-*
|
.waf-*
|
||||||
.waf3-*
|
.waf3-*
|
||||||
.lock-*
|
.lock-*
|
||||||
build
|
build
|
||||||
bundle_dependencies
|
resolve_symlinks
|
||||||
|
resolved_dependencies
|
||||||
|
|
||||||
# Gnu Global tag files
|
# Gnu Global tag files
|
||||||
GPATH
|
GPATH
|
||||||
@ -45,7 +47,6 @@ local.properties
|
|||||||
.settings/
|
.settings/
|
||||||
|
|
||||||
# Visual Studio ignore
|
# Visual Studio ignore
|
||||||
/bin
|
|
||||||
*.bat
|
*.bat
|
||||||
*.sln
|
*.sln
|
||||||
*.suo
|
*.suo
|
||||||
@ -54,6 +55,9 @@ local.properties
|
|||||||
*.sdf
|
*.sdf
|
||||||
*.opensdf
|
*.opensdf
|
||||||
*.log
|
*.log
|
||||||
|
*.vcxproj*
|
||||||
VSProjects
|
VSProjects
|
||||||
|
|
||||||
|
# astyle-specific files and folders
|
||||||
|
/AStyle
|
||||||
|
/bin
|
||||||
|
@ -34,13 +34,13 @@ def configure(properties):
|
|||||||
if properties.get('build_distclean'):
|
if properties.get('build_distclean'):
|
||||||
command += ['distclean']
|
command += ['distclean']
|
||||||
|
|
||||||
command += ['configure', '--git-protocol=git@']
|
command += ['configure', '--git_protocol=git@']
|
||||||
|
|
||||||
if 'waf_bundle_path' in properties:
|
if 'waf_resolve_path' in properties:
|
||||||
command += ['--bundle-path=' + properties['waf_bundle_path']]
|
command += ['--resolve_path=' + properties['waf_resolve_path']]
|
||||||
|
|
||||||
if 'dependency_project' in properties:
|
if 'dependency_project' in properties:
|
||||||
command += ['--{0}-use-checkout={1}'.format(
|
command += ['--{0}_checkout={1}'.format(
|
||||||
properties['dependency_project'],
|
properties['dependency_project'],
|
||||||
properties['dependency_checkout'])]
|
properties['dependency_checkout'])]
|
||||||
|
|
||||||
|
45
config.py
45
config.py
@ -1,45 +1,31 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
import urllib2
|
|
||||||
import traceback
|
import traceback
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
try:
|
||||||
|
input = raw_input
|
||||||
|
except NameError:
|
||||||
|
pass
|
||||||
|
|
||||||
project_name = 'astyle'
|
project_name = 'astyle'
|
||||||
project_dependencies = \
|
project_dependencies = \
|
||||||
[
|
[
|
||||||
'waf-tools',
|
'waf-tools',
|
||||||
]
|
]
|
||||||
|
|
||||||
# Importing a dynamically generated module
|
|
||||||
# Python recipe from http://code.activestate.com/recipes/82234
|
|
||||||
|
|
||||||
|
|
||||||
def importCode(code, name, add_to_sys_modules=0):
|
def importCode(code, name, add_to_sys_modules=0):
|
||||||
"""
|
"""
|
||||||
Import dynamically generated code as a module. code is the
|
Import dynamically generated code as a module.
|
||||||
object containing the code (a string, a file handle or an
|
Python recipe from http://code.activestate.com/recipes/82234
|
||||||
actual compiled code object, same types as accepted by an
|
|
||||||
exec statement). The name is the name to give to the module,
|
|
||||||
and the final argument says whether to add it to sys.modules
|
|
||||||
or not. If it is added, a subsequent import statement using
|
|
||||||
name will return this module. If it is not added to sys.modules
|
|
||||||
import will try to load it in the normal fashion.
|
|
||||||
|
|
||||||
import foo
|
|
||||||
|
|
||||||
is equivalent to
|
|
||||||
|
|
||||||
foofile = open("/path/to/foo.py")
|
|
||||||
foo = importCode(foofile,"foo",1)
|
|
||||||
|
|
||||||
Returns a newly generated module.
|
|
||||||
"""
|
"""
|
||||||
import imp
|
import imp
|
||||||
|
|
||||||
module = imp.new_module(name)
|
module = imp.new_module(name)
|
||||||
|
|
||||||
exec code in module.__dict__
|
exec(code, module.__dict__)
|
||||||
if add_to_sys_modules:
|
if add_to_sys_modules:
|
||||||
sys.modules[name] = module
|
sys.modules[name] = module
|
||||||
|
|
||||||
@ -52,22 +38,27 @@ if __name__ == '__main__':
|
|||||||
url = "https://raw.github.com/steinwurf/steinwurf-labs/" \
|
url = "https://raw.github.com/steinwurf/steinwurf-labs/" \
|
||||||
"master/config_helper/config-impl.py"
|
"master/config_helper/config-impl.py"
|
||||||
|
|
||||||
|
try:
|
||||||
|
from urllib.request import urlopen, Request
|
||||||
|
except ImportError:
|
||||||
|
from urllib2 import urlopen, Request
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Fetch the code file from the given url
|
# Fetch the code file from the given url
|
||||||
req = urllib2.Request(url)
|
req = Request(url)
|
||||||
response = urllib2.urlopen(req)
|
response = urlopen(req)
|
||||||
code = response.read()
|
code = response.read()
|
||||||
print("Update complete. Code size: {}\n".format(len(code)))
|
print("Update complete. Code size: {}\n".format(len(code)))
|
||||||
try:
|
try:
|
||||||
# Import the code string as a module
|
# Import the code string as a module
|
||||||
mod = importCode(code, "config_helper")
|
mod = importCode(code, "config_helper")
|
||||||
# Run the actual config tool from the dynamic module
|
# Run the actual config tool from the dynamic module
|
||||||
mod.config_tool(project_dependencies)
|
mod.config_tool(project_dependencies, project_name)
|
||||||
except:
|
except:
|
||||||
print("Unexpected error:")
|
print("Unexpected error:")
|
||||||
print traceback.format_exc()
|
print(traceback.format_exc())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Could not fetch code file from:\n\t{}".format(url))
|
print("Could not fetch code file from:\n\t{}".format(url))
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
raw_input('Press ENTER to exit...')
|
input('Press ENTER to exit...')
|
||||||
|
9
resolve.json
Normal file
9
resolve.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "waf-tools",
|
||||||
|
"resolver": "git",
|
||||||
|
"method": "semver",
|
||||||
|
"major": 4,
|
||||||
|
"sources": ["github.com/steinwurf/waf-tools.git"]
|
||||||
|
}
|
||||||
|
]
|
26
wscript
26
wscript
@ -6,40 +6,16 @@ import difflib
|
|||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from waflib.TaskGen import feature, after_method
|
from waflib.TaskGen import feature, after_method
|
||||||
from waflib import Errors
|
from waflib import Errors
|
||||||
import waflib.extras.wurf_options
|
|
||||||
|
|
||||||
APPNAME = 'astyle'
|
APPNAME = 'astyle'
|
||||||
VERSION = '0.1.0'
|
VERSION = '0.1.0'
|
||||||
|
|
||||||
|
|
||||||
def options(opt):
|
|
||||||
|
|
||||||
opt.load('wurf_common_tools')
|
|
||||||
|
|
||||||
|
|
||||||
def resolve(ctx):
|
|
||||||
|
|
||||||
import waflib.extras.wurf_dependency_resolve as resolve
|
|
||||||
|
|
||||||
ctx.load('wurf_common_tools')
|
|
||||||
|
|
||||||
ctx.add_dependency(resolve.ResolveVersion(
|
|
||||||
name='waf-tools',
|
|
||||||
git_repository='github.com/steinwurf/waf-tools.git',
|
|
||||||
major=3))
|
|
||||||
|
|
||||||
|
|
||||||
def configure(conf):
|
|
||||||
|
|
||||||
conf.load("wurf_common_tools")
|
|
||||||
|
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
|
|
||||||
bld.load("wurf_common_tools")
|
|
||||||
|
|
||||||
bld.env.append_unique(
|
bld.env.append_unique(
|
||||||
'DEFINES_STEINWURF_VERSION',
|
'DEFINES_STEINWURF_VERSION',
|
||||||
'STEINWURF_ASTYLE_VERSION="{}"'.format(VERSION))
|
'STEINWURF_ASTYLE_VERSION="{}"'.format(VERSION))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user