I'm studding as well this setup.py issue...

I'm actually trying try to integrate all dist related files and scripts 
into leoDist.leo using clones of << >> to store all shared distrib 
parameters (version, paths, changelogs...).
Actually I've done too many rough changes that haven't been debugged yet so 
I won't publish on github for a while.

However there are some useful informations I've found out while doing some 
tests :
Note that all these informations are related to* setuptools *but *not *
distutils:

First I think we have to make a distinction between the source tarball 
(setup.py sdist) vs  "binary" builds (ie setup.py bdist & setup.py install).
- Source tarball have to include every files that will be usefull including 
for development and distribution.
- "Binary" (ie nsis, deb, rpm...) and pip install can exclude all the files 
that will not be necessary to run the program (ie dist, test, and others 
tools).

Moreover, this make the subtle difference between MANIFEST.in 
include/exclude graft/prune functions and setup.py 
data_file/exclude_data_file.

 
*1- Binary builds and installation files (setup.py bdist & setup.py install 
& pip install)*

  The only way to define what files to install is whithin* setup.py* with 
those parameters :
    - package = find_packages() recursively find packages, (ie folders with 
*__init__.py*) : that is a first way to filter wanted/unwanted folders.
    - unwanted folders can also be specified this way : packages = 
find_packages(exclude=('leo.test',)) or when there are subfolders packages 
= find_packages(exclude=('leo.plugins*',))
    - By default only .py files under these packages/folders are included  
(+setup.py,setup.cfg and PKG-INFO)
    - package_data allow to add some more type of files with this syntax : 
        - add leo/module1/submodule1/icons folder and its jpg 
{'leo.module1.submodule1':['icons/*.jpg']} 
        - add every txt files within previously declared packages/folders + 
top level {'':['*.txt']}
    - The opposite is exclude_package_data which have the priority over 
package_data
    - Note 1 : with this previous parameters, no need to use data_files.
    - Note 2 : obviously, every or this folders/files will then 
automatically be included into the source tarball (setup.py sdist)


*2- Source tarball (setup.py sdist) and MANIFEST.in*

If we want that some other files to be included into the source tar but not 
installed on users system (mostly development related staff), we could 
specify them inside the file MANIFEST.in.
Basically, we can just include everything from the github repository but 
build files (__pycache__, pyc...).
   - Note1 : there is an setuptool option to automatically include all 
source files (ie defined in MANIFEST.in) into the builds / installation : 
include_package_data=True
     We would better not using this function to be able to differentiate 
sources & builds 



*My conclusions : *From my actual level of comprehension of the way of 
setup tool, I think I'm gonna work on this way :
- Include all files into sdist and control the few ones to remove with 
MANIFEST.in (.git related and builds .pyc __cache, html....)
- Not use data_file and os.walk anymore to select files to be installed, 
but instead select packages by adding __init__.py files (including docs to 
comment this packages) and find_packages() and additional files with 
package_data and exclude_package_data
- This way :
    - We'll only have python modules and dependencies installed into python 
path (ie. no hidden .leo files, doc, examples or scripts)
    - We could directly make nsis with recursive inclusion of every files 
from bdist_dump nsi-install-files.txt (File /r "Leo-5.0") (ie no more use 
of git-manifest)
    - We could adapt each distro installer (nsis, deb, rpm, mac...) to copy 
independent data files into distro specific directories (~/.leo/examples, 
~/.leo/doc, ~/.leo/test, \document and settings,...)
  

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to