Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are valid values for platforms in python setup.py?

The official documentation mentions this parameter but says nothing about possible values.

Is it necessary to use Operating System key in classifiers ?

like image 843
ddbug Avatar asked Aug 30 '16 02:08

ddbug


1 Answers

Well its not needed every time. But if you are doing something w.r.t platform and you don't intend to support all platforms in your program, then you need to base your program on platform.

Following are the os names that are currently registered in python

'posix', 'nt', 'os2', 'ce', 'java', 'riscos'

sys.builtin_module_names will list all the platforms that your python version supports. Again it will bring the modules based on your platform during installation.

you can base your program based on os.name

if os.name == 'nt':
    # do something for Windows
elif os.name == 'posix':
    # do something for all Linux and Mac platforms
elif os.name == 'os2':
    # do something
elif os.name == 'ce':
    # do something
elif os.name == 'java':
    # do something for java based platforms
elif os.name == 'riscos':
    # do something
like image 124
be_good_do_good Avatar answered Oct 05 '22 22:10

be_good_do_good