OS Neutrality in Python Development Guidelines?

Gedare Bloom gedare at rtems.org
Mon Apr 19 16:52:49 UTC 2021


On Sun, Apr 18, 2021 at 5:20 PM Joel Sherrill <joel at rtems.org> wrote:
>
>
>
> On Sun, Apr 18, 2021, 5:29 PM Chris Johns <chrisj at rtems.org> wrote:
>>
>> On 16/4/21 3:28 pm, Sebastian Huber wrote:
>> > On 15/04/2021 22:58, Gedare Bloom wrote:
>> >> I guess we should define something to add here? Is anything written
>> >> somewhere we can adopt?
>> > the spirit of the Python guide is to have rules which are enforced by tools.
>>
>> I see a guide as a means to provide robust and portable code in a common style
>> where we document and learn from our experiences. Any forced line like needing a
>> tool would create an artificial barrier where needed rules are not added because
>> we do not have a tool. I doubt any of us would want that to happen.
>>
>> > If
>> > a certain component should run on platform X, then I think some CI system should
>> > be in place which runs the test suite on platform X.
>>
>> This is hard to do, costs money and is only as good as a tests. It is important
>> but we should also use reviews as a way to catch issues.
>
>
> Does the PEP cover this? If so, then some tool should exist to help. Otherwise, we need some heuristics to at least flag an inspection.
>
> I had a shell script years ago to check BSPs for some basic rules and fixed a lot.  It was about the time we tried to be more standardized on file names in BSPs and some methods would always be in a file of a particular name. Not the brightest and hardest rules but the script could flag what needs to be inspected.
>>
>>
>> >> Was this considered at all under the pre-qual effort (which stimulated
>> >> these guidelines in the first place)? Do we have a Windows blind spot
>> >> in our Python code bases?
>> > The Python modules in rtems-central should run on Windows, however, I never
>> > tested this.
>>
>> A random pick of a file and a brief scan ...
>>
>> https://git.rtems.org/rtems-central/tree/rtemsspec/interface.py#n313
>>
>> For generating code it is important to make sure you use the platform's line
>> separator or git will get upset.
>
>
> Ok. And a grep would find these. Is this part of PEP?
>
> Are there files which should never have \n? All? Some?
>
> Is there other things that can be enforced now or we build some script which has a number of rules which we grow.
>

A quick look did not show any advice on writing code that works cross-platform.

The biggest issues are paths and CaseSensitive filesystems. I'm sure
there are other hidden brambles though.

>>
>> :)
>>
>> Chris
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list