How to install Python package from source on Windows

bartc bc at freeuk.com
Wed May 17 06:48:03 EDT 2017


On 17/05/2017 02:18, Chris Angelico wrote:
> On Wed, May 17, 2017 at 10:41 AM, bartc <bc at freeuk.com> wrote:
>> On 17/05/2017 00:24, Chris Angelico wrote:
>>>
>>> On Wed, May 17, 2017 at 9:01 AM, bartc <bc at freeuk.com> wrote:
>>
>>
>>> You mean like wheel files? Yeah, whodathunk. They don't need a C
>>> compiler or anything.
>>
>>
>> I don't know if that's the same kind of thing. I'm not talking about
>> something like a binary distribution or something that self-installs.
>>
>> I mean distributing actual source that needs to be built (so independent of
>> platform or compiler), but without having to download a sprawling directory
>> structure with thousands of files simply because that's the layout needed
>> during development. It's sort of in-between the developer's sources, and a
>> binary executable.
>
> *scratches head* What would that be? What is there between the
> developer's sources and the binary? Are you implying that we have
> messy development trees but we can run some program on them to produce
> perfect, pristine, portable code?

Yes. This is done for sqlite for example:

   https://www.sqlite.org/amalgamation.html

So people who want to just embed it in something else only have one main 
.c file to worry about. The original multi-file structure and all the 
gubbins needed to fit it all together are of no interest.

I do it on a smaller scale, combining dozens of source modules, which 
are not even in C, plus other files requiring interpreted utilities to 
set up (which then would require the sources of that interpreter),all 
into ONE .c file. There's not even a header. Then it can be trivially 
compiled.

You don't need a 35MB Git download (as I said, it's not the size, it's 
getting it installed, finding out what to type, finding out why it 
doesn't work...), you don't need a 6-8GB IDE, and you don't need to 
download Cygwin or MSYS (ie. half of Linux) if you want to build 
something that relies on Linux utilties.

Regarding portable code, there might be some tweaks needed to this model 
to get that. It might be that you have to use to choose between a .c 
file for Windows, and a .c file for Linux, similar to what happens now 
when downloading binaries. Alternatively, there can be one .c file with 
conditional sections.

There are ways of making things easier, simpler, more foolproof and with 
fewer external dependencies. But little effort seems to be expended on 
that; the developers don't care about having to inflict their own tools 
on everyone else.

-- 
bartc



More information about the Python-list mailing list