Skip to content

Commit

Permalink
#14 made the scripts to be executable
Browse files Browse the repository at this point in the history
  • Loading branch information
bugy committed Mar 3, 2017
1 parent d1e9a1a commit a0b8116
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
19 changes: 14 additions & 5 deletions assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,20 @@ def optimize_imports(assembled_content):
return result


entry_scripts = {"build.py": "rebuild.py",
"ci_build.py": "ci_rebuild.py"}
entry_scripts = {'build.py': 'rebuild.py',
'ci_build.py': 'ci_rebuild.py'}

for script_name, output_name in entry_scripts.items():
build_file_content = file_utils.read_file(script_name)
imported_files = ["build"]
imported_files = ['build']

assembled_content = ""
assembled_content = ''

shebang = None
if build_file_content.startswith('#!'):
splitted_content = build_file_content.split('\n', 1)
shebang = splitted_content[0]
build_file_content = splitted_content[1]

next_content = build_file_content
while next_content:
Expand All @@ -81,6 +87,9 @@ def optimize_imports(assembled_content):
assembled_content = optimize_imports(assembled_content)
assembled_content = string_utils.remove_empty_lines(assembled_content)

output_path = os.path.join("build", output_name)
if shebang:
assembled_content = shebang + '\n' + assembled_content

output_path = os.path.join('build', output_name)
file_utils.write_file(output_path, assembled_content)
file_utils.make_executable(output_path)
2 changes: 2 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python

from __future__ import print_function

import os.path
Expand Down
2 changes: 2 additions & 0 deletions ci_build.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python

import os.path

import common
Expand Down

0 comments on commit a0b8116

Please sign in to comment.