[RFC] using `if WINDOWS` instead of `if sys.platform == 'win32'`?

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Sep 6 11:22:31 BST 2007

>>>>> "bialix" == Alexander Belchenko <bialix at ukr.net> writes:

    bialix> There are around 100 places where bzrlib code try to check
    bialix> if it run on Windows by comparing `sys.platform == 'win32'`
    bialix> or similar. About the half of this checks is inside core code,
    bialix> and another half in tests.

    bialix> I'd like to change this places by defining in bzrlib/__init__.py
    bialix> constant with name 'WINDOWS' or something similar and use
    bialix> this constant where needed.

    bialix> WINDOWS = sys.platform == 'win32'

    bialix> ...

    bialix> if WINDOWS:
    bialix> 	do_something_crazy()

    bialix> if not WINDOWS:
    bialix> 	do_another_thing()

    bialix> Proposed change should make code more clear.
    bialix> Anyone have objections or suggestions?

Can you try to reduce the 100 places to functions inside osutils
instead ?


More information about the bazaar mailing list