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

  • Home
  • SEARCH
  • 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 3601610
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:38:35+00:00 2026-05-18T20:38:35+00:00

I’m trying to get a non-generated script when I run setup.py install for a

  • 0

I’m trying to get a non-generated script when I run setup.py install for a Python Package that I am building.

I have read the distutils documentation but couldn’t find clear examples on how to accomplish this.

Mercurial does this in some part by importing the install_scripts :

from distutils.command.install_scripts import install_scripts

And then goes on to replace some things within their hg script. This hg executable ends up being used overriding the default behavior of using something like this:

#!/Users/alfredo/python/foo/bin/python  
# EASY-INSTALL-SCRIPT: 'foo==0.0.1','foo'
__requires__ = 'foo==0.0.1'
import pkg_resources
pkg_resources.run_script('foo==0.0.1', 'foo')

I am trying not to end up using pkg_resources importing my foo package, but rather
end up with a script I am using. I’m aware why this is auto-generated and still want to
go the other route.

This is a copy of the base setup.py that I am using:

import distribute_setup
distribute_setup.use_setuptools()
from setuptools import setup

tests_require = ['pytest']

setup(
name = "foo",
version = "0.0.1",
packages = ['_foo'],

scripts = ['foo'],
zip_safe = False,
package_data = {'': ['distribute_setup.py']},
author = "Alfredo Deza",
author_email = "alfredodeza [at] gmail [dot] com",
description = "",
long_description = """\
Foo
""",
classifiers=[
    'Development Status :: 4 - Beta',
    'Intended Audience :: Developers',
    'License :: OSI Approved :: MIT License',
    'Topic :: Software Development :: Build Tools',
    'Programming Language :: Python :: 2.5',
    'Programming Language :: Python :: 2.6',
    'Programming Language :: Python :: 2.7',
  ],

license = "MIT",
keywords = "",
url = "",   

)
  • 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-05-18T20:38:36+00:00Added an answer on May 18, 2026 at 8:38 pm

    After days of digging around… it turns out that Mercurial is not doing anything special.

    Even though their setup.py does a lot of things it actually does not do anything to interfere with installing a script correctly without pkg_resources linking to it.

    What is the difference then?

    The difference is that I am using Distribute, and the way it works it overrides the setup module with its own (instead of setuptools) and thus it has its own different behavior for installation.

    In my case, that different way of installing scripts, means that a script foo will get copied over to the egg location and linked through a foo script that imports pkg_resources and links to that version.

    This is not what I want and I couldn’t find any Distribute documentation on it. However, it is clear they do so to provide a way of uninstallation later on.

    So beware! If you do want to go my path, you will have issues if you want to uninstall stuff.

    Until Distribute doesn’t provide a way for me to customize what to copy in my scripts I will have to switch back to regular setuptools

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

Sidebar

Related Questions

No related questions found

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.