title: Pyinstaller - Exclude files from final executable
body: <p>I am developing an cross platform application which ships additional binary files from source directory for linux and windows. Right now I am using following script in my *.spec file to include all binaries from the source directory.</p>
  
  <pre><code>##### include mydir in distribution #######
  def extra_datas(mydir):
      def rec_glob(p, files):
          import os
          import glob
          for d in glob.glob(p):
              if os.path.isfile(d):
                  files.append(d)
              rec_glob("%s/*" % d, files)
      files = []
      rec_glob("%s/*" % mydir, files)
      extra_datas = []
      for f in files:
          extra_datas.append((f, f, 'DATA'))
  
      return extra_datas
  ###########################################
  
  # append the 'data' dir
  a.datas += extra_datas('data')
  </code></pre>
  
  <p>All works well. Now the issue is that when i create binay from windows, all additional binaries of linux also shiped in the final executable. This makes the final stand alone executable bigger in size. </p>
  
  <p><strong>Is there a way to tell pyinstaller to execlude certain files/ binarries from source directory.</strong> Also <strong>is it possible to execlude certain *.so/ *.dll which are really not required in the final executable?</strong></p>
  
  <p>I use the following for development:-</p>
  
  <p>Python 2.7</p>
  
  <p>Pyinstaller 2.1</p>
  
  <p>Debian 7 for linux</p>
  
  <p>Windows 7 for Win </p>
  
  <p>Any help is appriciated.</p>