Monday 15 August 2011

python - Changing console_script entry point interpreter for packaging -


I am packaging some dragon packages using a well-known third-party packaging system, Getting the path to the problem Entry points are made.

When I place an entry point on my machine, whatever the Pygon interpreter will point to Shebang in the entry point, like:

Setup installation setup from Setuptools (Entry_points = {"console_scripts": ['some-entry-point = test: main' / home / me / develop / test / setup.py

,]})  /home/me/.virtualenvs/test/bin/some-entry-point  in Code>  

:

  #! / Home / me / .virtualenvs / test / bin / python #EZ-install-enter-script: 'test == 1.0.0', 'console_scripts',' some-entry-point '__requires__ =' test = = 1.0. 0 'pkg_resources Import import_driver_point sys.exit (load_entry_point (' test == 1.0.0 ',' console_scripts', 'some-entry-point') to import system ())   

As you can see, the entry point boilerplate has a hard-core path for Python interpreter which is in the virtual environment that I am using to create my third party package.

By installing this entry point by using my third party packaging system, the machine can be installed at the entry point. However, with this hard-coded reference of a dragon interpreter, which is not present on the target machine, the user must run python / path / to / some-entry-point .

Shebang it is very unused (which is definitely not a design target of virtual envision, but I need to make it a bit more portable.)

I'm crazy search / Ax / I do not support the side commands (though this is my fallback.)

Is there any way that I change the interpreter path after Shebang using the setuptools flag or config Can i

You can customize the console_scripts Shebang line by setting 'sys.exccable' (learned from one ) This means that ...

  sys.executable = '/ bin / custom_python' setup (entry point = {'console_scripts': [... etc ...]})   

Better, while creating a 'execution' argument will need to be included ...

  setup (entry point = {'console_scripts': [. .. etc ..}}, option = {'build_scripts': {'executable': '/ bin / custom_python',},})    

No comments:

Post a Comment