Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build tarballs from codeberg #41

Closed
andrei-a-papou opened this issue Feb 15, 2024 · 22 comments
Closed

Can't build tarballs from codeberg #41

andrei-a-papou opened this issue Feb 15, 2024 · 22 comments
Milestone

Comments

@andrei-a-papou
Copy link

I can't build https://codeberg.org/vonshednob/pter/archive/v3.15.2.tar.gz, the error is: error: can't copy 'man/pter.1': doesn't exist or not a regular file

Here's how I'm building:
python3 ./setup.py build && python3 ./setup.py install

Same thing happened with https://codeberg.org/vonshednob/pter/archive/v3.15.1.tar.gz, but interestingly I just downloaded https://vonshednob.cc/releases/pter-3.15.1.tar.gz and there was no problem. Apparently, the tarballs at codeberg and https://vonshednob.cc are different.

There's no tarball for 3.15.2 at https://vonshednob.cc, so now I'm stuck :) Can't install via pip as I need to patch the tarball first with my own set of patches.

@andrei-a-papou
Copy link
Author

OK, seems like apt install python3-docutils works around the issue, but shouldn't docutils be fetched by setup.py somehow and/or listed as deps? And why doesn't the issue occur with https://vonshednob.cc/releases/?

@vonshednob
Copy link
Owner

The tarball from my website has been produced with python -m build, so it’s not just the source code, but contains the generated man page, too.

I was rather reluctant to add docutils as a build-time dependency -- the pter package on pypi and on the website, as well as the one in AUR (all the same file, from python -m build) "just work". So adding docutils as a build-time dependency would be an unnecessary step. 🤔

How about adding a Development section to the README and add that type of information there?

@andrei-a-papou
Copy link
Author

andrei-a-papou commented Feb 16, 2024

How about adding a Development section to the README and add that type of information there?

IMO, that would be fine. For the record, this is what I use to build pter inside a Docker image (based on Debian 12/Bookworm):

apt-get install --no-install-recommends -y \
    python3.11-minimal python3-setuptools python3-docutils ca-certificates

cd /path/to/pter-source-dir && \
    python3 ./setup.py build && python3 ./setup.py install

The package ca-certificates is also needed on a minimal Debian install -- without it, no deps like pytodotxt can be downloaded.

@vonshednob
Copy link
Owner

Interesting, but I remember from my own experience with … uhm, something, that ca-certificates surprisingly is not installed by default. But I guess it makes sense for containers, similar to not installing man pages.

@andrei-a-papou
Copy link
Author

andrei-a-papou commented Feb 18, 2024

But I guess it makes sense for containers, similar to not installing man pages.

Yeah, this is inside the debian:bookworm-slim image. I guess they save space by not installing ca-certificates.

How about adding a Development section to the README and add that type of information there?

I've played with several build options recently and yes, adding instructions on how to build from both kinds of tarballs would be much appreciated.

Right now I can build from both kinds of tarballs using setup.py, but it turns out calling it directly is now deprecated (warnings get printed out).

Building using pip from a source directory fails for me: a man page is not found even after installing docutils. This is with 3.15.2, codeberg tarball. So I couldn't convert to using pip, unfortunately.

Running pip3 install pter works, but then it's hard or very awkward to apply my patches (of which I have more :))

So I'm stuck with using the deprecated setup.py, which works across the board -- for now. It's by no means a blocker, just something that will be hopefully addressed in the future.

@vonshednob
Copy link
Owner

I think the current thing to do is run python -m build and python -m install. Totally not a circular dependency when you need to install the install package first 🙃

@andrei-a-papou
Copy link
Author

andrei-a-papou commented Feb 19, 2024

OK, I've tried that, it appears to print the same warnings as pip:

warning: no files found matching '*.html' under directory 'pter'                                                                                                                               
warning: no files found matching '*' under directory 'man' 

Then errors out:

error: can't copy 'man/pter.1': doesn't exist or not a regular file

This is with codeberg tarball, v3.15.2. Package python3-docutils installed via apt-get.

(sigh) Back to setup.py :)

@vonshednob
Copy link
Owner

That's odd. With docutils it should be able to build the man page during python -m build 🤔 maybe there's another dependency that I forgot

@vonshednob vonshednob added this to the Version 3.16 milestone Feb 23, 2024
@vonshednob
Copy link
Owner

Okay, I give up for now -- apparently it's far from straight forward to declare a build-time dependency in python. I’ll try to make it not burst into flames when python is being build without having the docutils installed: e12dc7e0. Let me know if this worked.

@andrei-a-papou
Copy link
Author

andrei-a-papou commented Mar 10, 2024

Oh man, now I'm getting error: can't copy 'man/pter.1': doesn't exist or not a regular file even when building from git.

This happens when running python3 ./setup.py build && python3 ./setup.py install

What commands do you issue to build pter from git?

@vonshednob
Copy link
Owner

vonshednob commented Mar 10, 2024

Curious. I just clean-built in an empty virtualenv with that new configuration and it worked. At what step does it crash for you? python setup.py build or python setup.py install?

Edit: right, container… based on it trying to copy, it’s probably the install step.

@vonshednob
Copy link
Owner

Could you try to use pip install . instead of python setup.py?

@andrei-a-papou
Copy link
Author

andrei-a-papou commented Mar 10, 2024

I'm sorry, the error is slightly different, it's in regard to qpter, not pter. Sorry for the confusion.

Here's the actual error: error: can't copy 'man/pter/qpter.1': doesn't exist or not a regular file

So the install step still fails, but the error is different from the one in #41 (comment)

@andrei-a-papou
Copy link
Author

andrei-a-papou commented Mar 10, 2024

Could you try to use pip install . instead of python setup.py?

Yes, the following worked for me in a Docker container:

apt-get install --no-install-recommends -y \
    python3.11-minimal python3-pip python3-docutils ca-certificates
cd /tmp/pter && pip3 install --break-system-packages . && find /tmp/pter -delete

(For speed of hacking this Dockerfile, I didn't use a virtuaelnv nor do I care for one in an isolated container.)

UPD: apt install python3-docutils doesn't seem to be necessary for a successful build via pip.

@vonshednob
Copy link
Owner

I'm sorry, the error is slightly different, it's in regard to qpter, not pter. Sorry for the confusion.

No worries, I also missed that.

Here's the actual error: error: can't copy 'man/pter/qpter.1': doesn't exist or not a regular file

Yeah, that was me fumbling the patch. There really is no man/pter/qpter.1 file, but a man/qpter.1 file. 🤦

Anyway, should be fixed with 12ea984a

@andrei-a-papou
Copy link
Author

andrei-a-papou commented Mar 10, 2024

Now it builds fine via python3 ./setup.py build && python3 ./setup.py install.

But there is a bunch of warnings (they don't appear when building via pip):

doc/pter.config.rst:213: (WARNING/2) Inline literal start-string without end-string.                                                                                                           
doc/pter.config.rst:213: (WARNING/2) Inline literal start-string without end-string.                                                                                                           
doc/pter.config.rst:213: (WARNING/2) Inline literal start-string without end-string.                                                                                                           
doc/pter.config.rst:213: (WARNING/2) Inline literal start-string without end-string. 

The warnings are for the build stage. There are other warnings but they are related to the deprecated use of setup.py.

UPDATE: There are some other warnings (don't know if they are serious), I wrapped them in asterisks in context:

reating build/bdist.linux-x86_64/egg/EGG-INFO
copying pter.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pter.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pter.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pter.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pter.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pter.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
**zip_safe flag not set; analyzing archive contents...**
**pter.__pycache__.common.cpython-311: module references __file__**
creating dist
creating 'dist/pter-3.15.2.dev0-py3.11.egg' and adding 'build/bdist.linux-x86_64/egg' to it

@vonshednob
Copy link
Owner

The line 213 warning is … well, a speciality of trying to express "+-@ " (the last character is a space) in reStructuredText. I’ll verify this later. Thanks for the heads-up!

I guess the big win is that it builds and installs now.

@andrei-a-papou
Copy link
Author

I guess the big win is that it builds and installs now.

Absolutely!

@vonshednob
Copy link
Owner

I think I might have fixed the warning. D'you think this issue can be closed?

@andrei-a-papou
Copy link
Author

Tested with both setup.py and with pip3, you certainly did!

D'you think this issue can be closed?

Sure, it builds just fine now.

@andrei-a-papou
Copy link
Author

@vonshednob By the way, will you keep uploading tarballs to https://vonshednob.cc/pter/releases.html? I'm asking since one can build man pages form https://vonshednob.cc releases, which doesn't happen with tarballs from codeberg. And I sometimes need to do man pter :)

@vonshednob
Copy link
Owner

Absolutely! Documentation on the terminal is very much required in my opinion. Just haven't released 3.16 yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants