Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8878075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:37:31+00:00 2026-06-14T19:37:31+00:00

How can I write setup.py so that: The binary egg distribution ( bdist_egg )

  • 0

How can I write setup.py so that:

  1. The binary egg distribution (bdist_egg) includes a sample configuration file and
  2. Upon installation puts it into the {prefix}/etc directory?

A sample project source directory looks like this:

bin/
   myapp
etc/
   myapp.cfg
myapp/
    __init__.py
    [...]
setup.py

The setup.py looks like this:

from distutils.command.install_data import install_data

packages = ['myapp', ]
scripts = ['bin/myapp',]
cmdclasses = {'install_data': install_data}
data_files = [('etc', ['etc/myapp.cfg'])]

setup_args = {
    'name': 'MyApp',
    'version': '0.1',
    'packages': packages,
    'cmdclass': cmdclasses,
    'data_files': data_files,
    'scripts': scripts,
#    'include_package_data': True,
    'test_suite': 'nose.collector'
}

try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

setup(**setup_args)

setuptools are installed in both the build environment and in the installation environment.

The 'include_package_data' commented out or not does not help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:37:32+00:00Added an answer on June 14, 2026 at 7:37 pm

    I was doing some research on this issue and I think the answer is in the setuptools documentation: http://peak.telecommunity.com/DevCenter/setuptools#non-package-data-files

    Next, I quote the extract that I think has the answer:

    Non-Package Data Files

    The distutils normally install general “data files” to a
    platform-specific location (e.g. /usr/share). This feature intended to
    be used for things like documentation, example configuration files,
    and the like. setuptools does not install these data files in a
    separate location, however. They are bundled inside the egg file or
    directory, alongside the Python modules and packages. The data files
    can also be accessed using the Resource Management API […]

    Note, by the way, that this encapsulation of data files means that you
    can’t actually install data files to some arbitrary location on a
    user’s machine
    ; this is a feature, not a bug. You can always include a
    script in your distribution that extracts and copies your the
    documentation or data files to a user-specified location, at their
    discretion. If you put related data files in a single directory, you
    can use resource_filename() with the directory name to get a
    filesystem directory that then can be copied with the shutil module.
    […]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone please tell me how I can write a bash shell script that
Can someone please explain how you can write a url pattern and view that
In SQL one can write a query that searches for a name of a
I am wanting to write a WCF web service that can send files over
So I have been writing to Environment.SpecialFolder.ApplicationData this data file, that upon uninstall needs
FINAL UPDATE This question is about how to write a setup.py that will compile
You can write //google.com instead of http://google.com and https://google.com where // is relative to
I can write an assertion message one of two ways. Stating success: assertEquals( objects
We can write CSS as the following types: Inline CSS Embedded CSS External CSS
I can write something, I'm asking if something is already built into jQuery.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.