[distutils] Install script under a different name

Nikolaus Rath Nikolaus at rath.org
Sat Dec 5 11:08:01 EST 2009


Lie Ryan <lie.1296 at gmail.com> writes:
> On 12/5/2009 11:34 AM, Nikolaus Rath wrote:
>> Hello,
>>
>> All my Python files have extension .py. However, I would like to install
>> scripts that are meant to be called by the user without the suffix, i.e.
>> the file scripts/doit.py should end up as /usr/bin/doit.
>>
>> Apparently the scripts= option of the setup() function does not support
>> this directly. Is there a clever way to get what I want?
>
> if this is on windows, you should add ".py" to the PATHEXT environment
> variable.
>
> on linux/unix, you need to add the proper #! line to the top of any
> executable scripts and of course set the executable bit permission
> (chmod +x scriptname). In linux/unix there is no need to have the .py
> extension for a file to be recognized as python script (i.e. just
> remove it).

Sorry, but I think this is totally unrelated to my question. I want to
rename files during the setup process. This is not going to happen by
adding/changing any #! lines or the permissions of the file.

I know that there is no need to have the .py extension, that's why I
want to install the scripts without this suffix. But in my source
distribution I want to keep the suffix for various reasons.

Best,

   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C



More information about the Python-list mailing list