I think the long term perfect solution is using eol-style attribute. But I'm
not sure whether souceforge support this feature. And for short term, I've
fixed the mixed use of CR and CRLF. The recommendation is CRLF for all sources
except .sh scripts. You can also find similar recommendation in Build spec
section 4.1.
Thanks,
Hot
From: Andrew Fish [mailto:[email protected]]
Sent: Friday, January 24, 2014 1:08 AM
To: Olivier Martin
Cc: [email protected]
Subject: Re: [edk2-buildtools] BaseTools Coding Style - Line Endings
On Jan 23, 2014, at 2:47 AM, Olivier Martin
<[email protected]<mailto:[email protected]>> wrote:
Do you confirm the EDK2 BaseTools coding style apply to BaseTools too?
It would mean C sources must have CRLF line endings.
What about Python source files? It looks there is no requirement on the line
endings in Python source files. The Python Coding style in
EDK2:https://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Code_Style/Python
refers to
http://www.python.org/dev/peps/pep-0008/.<http://www.python.org/dev/peps/pep-0008/>
But there is no reference to the line endings.
On this page
'http://docs.python.org/3/tutorial/interpreter.html#executable-python-scripts',<http://docs.python.org/3/tutorial/interpreter.html#executable-python-scripts%27,>
you can also read:
On BSD'ish Unix systems, Python scripts can be made directly executable, like
shell scripts (...) On some platforms, this first line must end with a
Unix-style line ending ('\n'), not a Windows ('\r\n') line ending.
But we do not directly call the Python BaseTools script from the shell. We go
through $EDK2_ROOT/BaseTools/BinWrappers/PosixLike/ scripts.
Some files in BaseTools have mixed line endings. Control Version Systems
complain about it. Example:
- BaseTools\Source\C\GenFw\elf_common.h: mixed CR & CRLF
- BaseTools\Source\Python\GenFds\Fv.py: mixed CR & CRLF
- BaseTools\Source\Python\GenFds\GenFdsGlobalVariable.py: mixed CR &
CRLF
What is the recommended line endings for Python sources?
I would point out that subversion can help with this. A property of
svn:eol-style of native will cause Subversion to store all files internally
with LF, If you checkout from windows you get CRLF and if you checkout from
Unix you get LF.
Bash scripts with CRLF crash on Mach OS X. So they need to be LF to function.
In general it seems there are a lot of editors that get confused with a mixed
scheme, so cleaning up the miss matches is a good idea. But to me it seems the
requirement should be to commit in native line endings and setup svn to
automatically convert.
Thanks,
Andrew Fish
Thanks,
Olivier
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk_______________________________________________
edk2-buildtools-devel mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/edk2-buildtools-devel
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
edk2-buildtools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-buildtools-devel