Skip to content

Commit

Permalink
Fix wscript formatting to follow PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
Meiguro committed Dec 13, 2015
1 parent fd2bc67 commit 828a97a
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ from waflib.Configure import conf
top = '.'
out = 'build'


def options(ctx):
ctx.load('pebble_sdk')

ctx.load('aplite_legacy', tooldir='waftools')
ctx.load('configure_appinfo', tooldir='waftools')
ctx.load('pebble_sdk_version', tooldir='waftools')


def configure(ctx):
ctx.load('pebble_sdk')

Expand All @@ -25,6 +27,7 @@ def configure(ctx):
else:
ctx.configure_platform()


def build(ctx):
ctx.load('pebble_sdk')

Expand All @@ -46,13 +49,14 @@ def build(ctx):
worker_elf=elfs['worker_elf'] if 'worker_elf' in elfs else None,
js=js_target)


@conf
def configure_platform(ctx, platform=None):
if platform is not None:
ctx.setenv(platform, ctx.all_envs[platform])

cflags = ctx.env.CFLAGS
cflags = [ x for x in cflags if not x.startswith('-std=') ]
cflags = [x for x in cflags if not x.startswith('-std=')]
cflags.extend(['-std=c11',
'-fms-extensions',
'-Wno-address',
Expand All @@ -61,25 +65,27 @@ def configure_platform(ctx, platform=None):

ctx.env.CFLAGS = cflags


@conf
def build_platform(ctx, platform=None, binaries=None):
if platform is not None:
ctx.set_env(ctx.all_envs[platform])

build_worker = os.path.exists('worker_src')

app_elf='{}/pebble-app.elf'.format(ctx.env.BUILD_DIR)
app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR)
ctx.pbl_program(source=ctx.path.ant_glob('src/**/*.c'),
target=app_elf)

if build_worker:
worker_elf='{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR)
worker_elf = '{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR)
binaries.append({'platform': platform, 'app_elf': app_elf, 'worker_elf': worker_elf})
ctx.pbl_worker(source=ctx.path.ant_glob('worker_src/**/*.c'),
target=worker_elf)
else:
binaries.append({'platform': platform, 'app_elf': app_elf})


@conf
def concat_javascript(ctx, js_path=None):
js_nodes = (ctx.path.ant_glob(js_path + '/**/*.js') +
Expand All @@ -98,9 +104,9 @@ def concat_javascript(ctx, js_path=None):

def loader_translate(source, lineno):
return LOADER_TEMPLATE.format(
relpath=json.dumps(source['relpath']),
lineno=lineno,
body=source['body'])
relpath=json.dumps(source['relpath']),
lineno=lineno,
body=source['body'])

def coffeescript_compile(relpath, body):
try:
Expand Down Expand Up @@ -135,11 +141,11 @@ def concat_javascript(ctx, js_path=None):
if relpath == LOADER_PATH:
sources.insert(0, body)
else:
sources.append({ 'relpath': relpath, 'body': body })
sources.append({'relpath': relpath, 'body': body})

with open(APPINFO_PATH, 'r') as f:
body = JSON_TEMPLATE.format(body=f.read())
sources.append({ 'relpath': APPINFO_PATH, 'body': body })
sources.append({'relpath': APPINFO_PATH, 'body': body})

sources.append('__loader.require("main");')

Expand Down

0 comments on commit 828a97a

Please sign in to comment.