Re: easy_install doesn't install non-package *.py file

2011-11-10 Thread Jonathan Hartley
Hey. I don't know the details, but your setup.py needs to use either the 
'package_data' or the 'data_files' entry in the dict you pass to setup. These 
can specify files you want included in the sdist which aren't package files.

There are many complications with using them though. One of them in particular 
(I don't remember which one) installs the files you specify in a different 
place depending on whether the user is installing the sdist from local files 
(python setup.py install) or using pip, so be sure to test both ways. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: easy_install doesn't install non-package *.py file

2011-11-10 Thread Makoto Kuwata
On Thu, Nov 10, 2011 at 6:08 PM, Jonathan Hartley tart...@tartley.com wrote:
 Hey. I don't know the details, but your setup.py needs to use either the 
 'package_data' or the 'data_files' entry in the dict you pass to setup. These 
 can specify files you want included in the sdist which aren't package files.

 There are many complications with using them though. One of them in 
 particular (I don't remember which one) installs the files you specify in a 
 different place depending on whether the user is installing the sdist from 
 local files (python setup.py install) or using pip, so be sure to test both 
 ways.

'package_data' is the solution for my trouble.
Thank you very much, Jonathan.

--
regards,
makoto kuwata
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: easy_install doesn't install non-package *.py file

2011-11-09 Thread Makoto Kuwata
On Wed, Nov 9, 2011 at 4:09 AM, Terry Reedy tjre...@udel.edu wrote:
 On 11/7/2011 11:32 PM, Makoto Kuwata wrote:

 I got trouble about easy_install command.

 My package:

   README.rst
   setup.py
   foobar/
   foobar/__init__.py
   foobar/data/
   foobar/data/template.py

 In the above example, 'foobar/data/template.py' is just a
 template data file (= not a python module file).

 Then why is it .py? If it is just data, use .txt. If .py, it should be
 python code run either directly or imported, though I suppose you could exec
 it. (I have no idea how renaming would affect your problem.)


I want to use template names according to language,
such as template.py, template.html, template.rst, template.js, and so on.

My question is how to include non-python files into egg file?
I may change file name suffix from '.py' to '.py.template',
but it doesn't solve my problem.

--
regards,
makoto kuwata
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: easy_install doesn't install non-package *.py file

2011-11-09 Thread Makoto Kuwata
On Thu, Nov 10, 2011 at 9:58 AM, Makoto Kuwata k...@kuwata-lab.com wrote:
 On Wed, Nov 9, 2011 at 4:09 AM, Terry Reedy tjre...@udel.edu wrote:
 On 11/7/2011 11:32 PM, Makoto Kuwata wrote:

 I got trouble about easy_install command.

 My package:

   README.rst
   setup.py
   foobar/
   foobar/__init__.py
   foobar/data/
   foobar/data/template.py

 In the above example, 'foobar/data/template.py' is just a
 template data file (= not a python module file).

 Then why is it .py? If it is just data, use .txt. If .py, it should be
 python code run either directly or imported, though I suppose you could exec
 it. (I have no idea how renaming would affect your problem.)


 I want to use template names according to language,
 such as template.py, template.html, template.rst, template.js, and so on.

 My question is how to include non-python files into egg file?
 I may change file name suffix from '.py' to '.py.template',
 but it doesn't solve my problem.

I create sample project to explain my trouble.
Sample project source code:
https://bitbucket.org/kwatch/helloworld/src


When 'python setup.py sdist', all files are copied correctly.
https://bitbucket.org/kwatch/helloworld/wiki/python_setup.py_sdist

$ python setup.py sdist

hard linking helloworld/__init__.py - HelloWorld-0.1.0/helloworld
hard linking helloworld/foo.py - HelloWorld-0.1.0/helloworld
hard linking helloworld/sub/__init__.py - HelloWorld-0.1.0/helloworld/sub
hard linking helloworld/sub/bar.py - HelloWorld-0.1.0/helloworld/sub



But when 'python setup.py bdist_egg', some files are not copied.
https://bitbucket.org/kwatch/helloworld/wiki/python_setup.py_bdist_egg

$ python setup.py bdist   # 'helloworld/sub/{__init__,bar}.py' are
not copied!

copying build/lib/helloworld/__init__.py -
build/bdist.macosx-10.4-x86_64/egg/helloworld
copying build/lib/helloworld/foo.py -
build/bdist.macosx-10.4-x86_64/egg/helloworld



Could you help me?

--
regards,
makoto kuwata
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: easy_install doesn't install non-package *.py file

2011-11-09 Thread Chris Angelico
On Thu, Nov 10, 2011 at 11:58 AM, Makoto Kuwata k...@kuwata-lab.com wrote:
 I want to use template names according to language,
 such as template.py, template.html, template.rst, template.js, and so on.


You may have another problem here. Everyone and everything that looks
at these will expect them to be Python, HTML, etc files. If they're
not, it may cause confusion in other ways.

Can you switch it around, py.template and html.template etc?

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: easy_install doesn't install non-package *.py file

2011-11-08 Thread Terry Reedy

On 11/7/2011 11:32 PM, Makoto Kuwata wrote:

I got trouble about easy_install command.

My package:

   README.rst
   setup.py
   foobar/
   foobar/__init__.py
   foobar/data/
   foobar/data/template.py

In the above example, 'foobar/data/template.py' is just a
template data file (= not a python module file).


Then why is it .py? If it is just data, use .txt. If .py, it should be 
python code run either directly or imported, though I suppose you could 
exec it. (I have no idea how renaming would affect your problem.)



(notice that 'foobar/data/__init__.py' doesn't exist.)


I did, and no, I do not know the answer to your question.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


easy_install doesn't install non-package *.py file

2011-11-07 Thread Makoto Kuwata
I got trouble about easy_install command.

My package:

  README.rst
  setup.py
  foobar/
  foobar/__init__.py
  foobar/data/
  foobar/data/template.py

In the above example, 'foobar/data/template.py' is just a
template data file (= not a python module file).
(notice that 'foobar/data/__init__.py' doesn't exist.)

In this case, 'foobar/data/template.py' file is NOT installed
when trying 'easy_install foobar'.
This is trouble what I got.

I found that:

* foobar.tar.gz created by 'easy_install sdist' contains
  'foobar/data/template.py' correctly.
* foobar.egg created by 'easy_install bdist' doesn't contain
  'foobar/data/template.py' file.

Question: how can I enforce easy_install command to
install 'foobar/data/template.py' (or non-package *.py file)?

--
regars,
makoto kuwata
-- 
http://mail.python.org/mailman/listinfo/python-list