Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
3ac73108
Commit
3ac73108
authored
Mar 09, 2014
by
Peter Gehres
Committed by
James Cammarata
Apr 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for #6353 adding a newline between assembled files
parent
729e20ae
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
+10
-1
library/files/assemble
+10
-1
No files found.
library/files/assemble
View file @
3ac73108
...
...
@@ -102,11 +102,18 @@ def assemble_from_fragments(src_path, delimiter=None, compiled_regexp=None):
tmpfd
,
temp_path
=
tempfile
.
mkstemp
()
tmp
=
os
.
fdopen
(
tmpfd
,
'w'
)
delimit_me
=
False
for
f
in
sorted
(
os
.
listdir
(
src_path
)):
if
compiled_regexp
and
not
compiled_regexp
.
search
(
f
):
continue
fragment
=
"
%
s/
%
s"
%
(
src_path
,
f
)
if
delimit_me
and
delimiter
:
# delimiters should only appear between fragments
if
delimit_me
:
# always put a newline between fragments
tmp
.
write
(
'
\n
'
)
if
delimiter
:
# un-escape anything like newlines
delimiter
=
delimiter
.
decode
(
'unicode-escape'
)
tmp
.
write
(
delimiter
)
...
...
@@ -114,9 +121,11 @@ def assemble_from_fragments(src_path, delimiter=None, compiled_regexp=None):
# delimiter, so lines don't run together
if
delimiter
[
-
1
]
!=
'
\n
'
:
tmp
.
write
(
'
\n
'
)
if
os
.
path
.
isfile
(
fragment
):
tmp
.
write
(
file
(
fragment
)
.
read
())
delimit_me
=
True
tmp
.
close
()
return
temp_path
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment