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

Create Specfile from a virtual file #206

Open
FrostyX opened this issue Feb 4, 2023 · 4 comments
Open

Create Specfile from a virtual file #206

FrostyX opened this issue Feb 4, 2023 · 4 comments
Labels
area/general Related to whole service, not a specific part/integration. complexity/single-task Regular task, should be done within days. enhancement New feature or request gain/low This doesn't bring that much value to users. impact/low This issue impacts only a few users. kind/feature New feature or a request for enhancement.

Comments

@FrostyX
Copy link

FrostyX commented Feb 4, 2023

Currently, it is possible to create an object of Specfile like this:

# using an absolute path
specfile = Specfile('/tmp/test.spec')

# using a relative path and a different sourcedir
specfile = Specfile('test.spec', sourcedir='/tmp/sources')

It would be nice to be able to create it also like this

with open('/tmp/test.spec', 'r') as fp:
    specfile = Specfile(fp)

This alone is not so interesting, but it allows for creating Specfile from a virtual file

from io import StringIO
fp = StringIO()
fp.write("Name: foo\nVersion: 1.0\nRelease: 1\n...")
specfile = Specfile(fp)

Of course, I am interested in the feature, not the exact syntax. My suggestion will probably have an issue with the .save() method so if it is done like

specfile = Specfile(fp=fp)

# or

specfile = Specfile.from_fp(fp)

It is all fine with me :-)

@nforro
Copy link
Member

nforro commented Feb 6, 2023

This shouldn't be a problem, I'd probably go with adding a fp argument to the constructor. However, sourcedir would have to be specified when using fp.

@TomasTomecek TomasTomecek added the enhancement New feature or request label Feb 6, 2023
@majamassarini majamassarini added area/general Related to whole service, not a specific part/integration. complexity/single-task Regular task, should be done within days. gain/low This doesn't bring that much value to users. impact/low This issue impacts only a few users. kind/feature New feature or a request for enhancement. labels May 9, 2024
@majamassarini
Copy link
Member

Still relevant but low priority.

@majamassarini
Copy link
Member

@FrostyX is this still useful for you?

@FrostyX
Copy link
Author

FrostyX commented May 10, 2024

Still relevant but low priority.
@FrostyX is this still useful for you?

No problem with me. Somewhere (if I could only remember where) I wanted to do this and couldn't, so I workarounded it by saving the specfile from a variable to a temporary file and using Specfile the standard way.

I still think it is useful but I agree with the low priority since it can be easily workarounded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/general Related to whole service, not a specific part/integration. complexity/single-task Regular task, should be done within days. enhancement New feature or request gain/low This doesn't bring that much value to users. impact/low This issue impacts only a few users. kind/feature New feature or a request for enhancement.
Projects
Status: backlog
Development

No branches or pull requests

4 participants