how to write setup.py for this application structure?
Question: I have written an application with python (2.7). The structure looks like:

    
    
    kent$  tree myApp
    myApp
    |-- foo.py
    |-- gui
    |   |-- g1.py
    |   |-- g2.py
    |   |-- g3.py
    |   `-- __init__.py
    |-- icons
    |   |-- a.png
    |   `-- e.png
    |-- logic
    |   |-- __init__.py
    |   |-- l1
    |   |   |-- __init__.py
    |   |   |-- la.py
    |   |   `-- lc.py
    |   |-- l2
    |   |   |-- __init__.py
    |   |   |-- ld.py
    |   |   `-- lf.py
    |   |-- logic1.py
    |   |-- logic2.py
    |   `-- logic3.py
    |-- myApp.py
    `-- resources
        |-- x.data
        `-- z.data
    

Now I am about to write a `setup.py` to distribute my application. I am new to
this. After reading the py doc and doing some testing. a few questions come
up:

  1. **how can I (or should I) package my root package (myApp) under`/lib/python/site-package` ?**

since in my py file, I reference resources/icons by relative path. for
example, in `foo.py` there could be `icons/a.png` and in `gui/g1.py` there
could be `../icons/e.png` and so on

  2. **how can I package`icons` and `resources` directory?**

It seems that `package_data` and `data_files` won't copy the two directories
to right place.

  3. **is this the right way?**
    
        packages = [''],
    package_dir = {'': ''},
    package_data= {'': ['icons/*.*', 'resources/*.*']},
    

after install, my files will be:

    
        /usr/lib/python2.7/site-packages/icons/*.png
    /usr/lib/python2.7/site-packages/resources/*.data
    /usr/lib/python2.7/site-packages/gui/...
    /usr/lib/python2.7/site-packages/logic/...
    

  4. **Is there problem of my application structure?**

should those resources/icons/whatever files go to certain python package, not
under the project root? so that in setup.py I can use `package_data` to copy
them to right place.


Answer: 
    from ez_setup import use_setuptools
    use_setuptools()
    from setuptools import setup
    
    setup(name="somename",
          version="1.0",
          description="description string",
          long_description="""\
    long description
    """,
          author="Foo",
          author_email="bar@gmail.com",
          url="http://nowhere.com",
          include_package_data=True,
          license="MIT",
          packages=["gui", "logic"],
          package_dir={
                "gui": "myApp/gui",
                "logic": "myApp/logic",
                },
          classifiers=[
             "Development Status :: 5 - Production/Stable",
             "Topic :: Utilities",
             "License :: OSI Approved :: MIT License"
          ],
          data_files=[
              ('/path/to/resources', ['resources/x.data', 'resources/y.data']),
              ('/path/to/icons', ['myApp/icons/a.ico', 'myApp/icons/e.ico'])
          ]
          )
    

