[Python-Dev] Re: Why doesn't venv also install python3*-config?

2020-01-13 Thread Barry Scott


> On 12 Jan 2020, at 16:20, [email protected] wrote:
> 
> Hi guys,
> 
> after I got the whole list into a lather about the merits of
> the python-config program, let me rephrase the question:
> 
> Is there a "canonical" way of automatically finding the correct
> include files and Python runtime library when embedding the Python
> interpreter, based on the current virtual environment (and not the
> "installed" version)? Upon reding the docs there isn't. And maybe there
> should't or cant be any. So if I want to try embedding Python under
> different versions I have to either install those into different
> directories and use python-config, or I write a trivial Python program
> that finds the correct values for the current environment using
> sysconfig and outpus those as compiler / linker flags. Easy enough, I
> was just surprised that no such solution was already built into the
> virtualenv setup mechanism
> 
> Here's a quote from the docs
> """
> If this procedure [using python-config] doesn’t work for you (it is not
> guaranteed to work for all Unix-like platforms; however, we welcome bug
> reports) you will have to read your system’s documentation about
> dynamic linking and/or examine Python’s Makefile (use
> sysconfig.get_makefile_filename() to find its location) and compilation
> options. In this case, the sysconfig module is a useful tool to
> programmatically extract the configuration values that you will want to
> combine together. For example:
> 
 import sysconfig
 sysconfig.get_config_var('LIBS')
> '-lpthread -ldl  -lutil'
 sysconfig.get_config_var('LINKFORSHARED')
> '-Xlinker -export-dynamic'
> """

I build a python C++ extension called pysvn. It's build system works
by running a python program to generate a native makefile for
Windows, macOS, Fedora, NetBSD etc. The code support
python 2 and all the python 3's.

I have all the python versions installed on my build systems
side-by-side. I did not need to use venv as all the python's
are installled into the systems.

Maybe you can use some of the ideas from the code.
See this module:

https://svn.code.sf.net/p/pysvn/code/trunk/pysvn/Extension/Source/setup_configure.py
 


Barry


> ___
> Python-Dev mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/[email protected]/message/364Q6EZHSFN6DGUUDN3FKOMK4CDS3WJB/
> Code of Conduct: http://python.org/psf/codeofconduct/

___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/MIGP4B6FD4HFAHK4OT5SSGQDHNR74TB6/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Why doesn't venv also install python3*-config?

2020-01-13 Thread Daniel Haude

Am 12.01.2020 23:39 schrieb Ivan Pozdeev via Python-Dev:


Virtualenv does create `python-config` shim in Linux.


Python3 doesn't. Definetely. Not on RHEL7 and Debian, that's where I 
tested it.

___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/52ZEDRORRPB4NRW54WIRVSCKY34RUM2Y/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Why doesn't venv also install python3*-config?

2020-01-13 Thread Janzert

On 1/13/2020 8:21 AM, Daniel Haude wrote:

Am 12.01.2020 23:39 schrieb Ivan Pozdeev via Python-Dev:


Virtualenv does create `python-config` shim in Linux.


Python3 doesn't. Definetely. Not on RHEL7 and Debian, that's where I 
tested it.



Just to ensure there's no confusion; note that "venv" and "virtualenv" 
are two related but different packages (venv being included in the 
standard library and virtualenv available on pypi).


At least here on Ubuntu 18.04 with python 3.6 venv and virtualenv 
16.7.9, venv does not include python-config and virtualenv does.


Janzert
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/UT4F4JEADTZX5IH5QMZW66A4WJIOS2KV/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Why doesn't venv also install python3*-config?

2020-01-13 Thread Ivan Pozdeev via Python-Dev

On 13.01.2020 16:21, Daniel Haude wrote:


Am 12.01.2020 23:39 schrieb Ivan Pozdeev via Python-Dev:


Virtualenv does create `python-config` shim in Linux.


Python3 doesn't. Definetely. Not on RHEL7 and Debian, that's where I tested it.


You are right, I've got it mixed up. Virtualenv creates `python-config`. Venv 
doesn't.

$ pyenv local 3.6.9
$ pip install virtualenv
<...>
$ virtualenv test_vi
Using base prefix '/home/vmuser/.pyenv/versions/3.6.9'
New python executable in /home/vmuser/test_vi/bin/python3.6
Also creating executable in /home/vmuser/test_vi/bin/python
Installing setuptools, pip, wheel...
done.
$ python -m venv test_ve
$ ls test_ve/bin/
activate  activate.csh  activate.fish  easy_install easy_install-3.6  pip  pip3 
 pip3.6  python  python3
$ ls test_vi/bin/
activate  activate.fish  activate_this.py  easy_install pip   pip3.6  
python3    python-config
activate.csh  activate.ps1   activate.xsh  easy_install-3.6 pip3  python  
python3.6  wheel

--
Regards,
Ivan
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/JPSSRLY5HLVRG6FMX53ZU2XIXB6LY5XI/
Code of Conduct: http://python.org/psf/codeofconduct/