0

I'm hacking an existing python tool (using Tkinter GUI) that has a setup.py written for windows (its dependencies include py2exe and Tix) the import statement has

from distutils.core import setup
import py2exe
import os
import glob

setup(console=['mainFileName.py'],...

and under data_files=[... it includes a lot of .dll files i'm guessing it doesn't need if it compiles on linux. I can run the tool if I just call python mainFileName.py but I'm not sure how do deal with it in the setup.py file

thanks!

Jon C
  • 1
  • 1
    You need to give more information here, but generally platform-specific code is handled by using `if` statements with the `platform` library. https://docs.python.org/2/library/platform.html. Also see this: https://docs.python.org/2/library/sys.html#sys.platform – Chinmay Kanchi Sep 11 '14 at 22:50

1 Answers1

2

One of the most basic uses would look like this:

import platform

if platform.system() == 'Linux':
    import foo
elif platform.system() == 'Darwin':
    import yass
elif platform.system() == 'Windows':
    import sigh
else:
    raise OSError('Unknown Operating System: {} {}'.format(platform.os.name, platform.system()))
jgritty
  • 11,660
  • 3
  • 38
  • 60