Skip to content

REF: Use soname package for Windows too - #25

Merged
carterbox merged 17 commits into
conda-forge:mainfrom
carterbox:soname-package-windows
Feb 8, 2024
Merged

REF: Use soname package for Windows too#25
carterbox merged 17 commits into
conda-forge:mainfrom
carterbox:soname-package-windows

Conversation

@carterbox

@carterbox carterbox commented Jan 2, 2024

Copy link
Copy Markdown
Member

Checklist

  • Used a personal fork of the feedstock to propose changes
  • Bumped the build number (if the version is unchanged)
  • Reset the build number to 0 (if the version changed)
  • Re-rendered with the latest conda-smithy (Use the phrase @conda-forge-admin, please rerender in a comment in this PR for automated rerendering)
  • Ensured the license file is being packaged.

@conda-forge-webservices

Copy link
Copy Markdown
Contributor

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

I do have some suggestions for making it better though...

For recipe:

  • It looks like the '_libavif_api' output doesn't have any tests.

@carterbox
carterbox force-pushed the soname-package-windows branch from 61732d5 to c2c8b6b Compare January 5, 2024 05:17
@carterbox
carterbox marked this pull request as ready for review February 5, 2024 23:19
@carterbox
carterbox requested a review from hmaarrfk as a code owner February 5, 2024 23:19
@carterbox

Copy link
Copy Markdown
Member Author

@conda-forge-admin, please rerender

conda-forge-webservices[bot] and others added 4 commits February 5, 2024 23:21
@conda-forge-webservices

Copy link
Copy Markdown
Contributor

Hi! This is the friendly automated conda-forge-linting service.

I was trying to look for recipes to lint for you, but it appears we have a merge conflict.
Please try to merge or rebase with the base branch to resolve this conflict.

Please ping the 'conda-forge/core' team (using the @ notation in a comment) if you believe this is a bug.

@conda-forge-webservices

Copy link
Copy Markdown
Contributor

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

I do have some suggestions for making it better though...

For recipe:

  • It looks like the '_libavif_api' output doesn't have any tests.

@hmaarrfk

hmaarrfk commented Feb 6, 2024

Copy link
Copy Markdown
Contributor

do you actually need my review?

It looks pretty good. not sure i love the install.py script but willing to see where it goes!

@carterbox

Copy link
Copy Markdown
Member Author

Yes, I want your review because this is a new idea that I plan to copy to other feedstocks!

The install.py script is supposed to be reusable across multiple recipes. It saves recipe writing maintenance time because it allows the author to avoid writing custom file lists like:

      - include/avif             # [unix]
      - Library\\include\\avif   # [win]
      - lib/libavif.so     # [linux]
      - lib/libavif.dylib  # [osx]
      - Library\\bin\\avif.dll   # [win]
      - Library\\lib\\avif.lib   # [win]
      - lib/pkgconfig/libavif.pc             # [unix]
      - Library\\lib\\pkgconfig\\libavif.pc  # [win]
      - lib/cmake/libavif             # [unix]
      - Library\\lib\\cmake\\libavif  # [win]

for each output of a multi-output recipe.

Do you have any more specific feedback about the install.py script? Any way that I could make it simpler or easier to understand?

Comment thread recipe/install.py Outdated

# libfoo-static
# libdav1d-static, libv8-static, libm-static, libsecp256k1-static
if re.match(f"^lib{ basename }-static$", PKG_NAME):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if re.match(f"^lib{ basename }-static$", PKG_NAME):
if "lib{ basename }-static" == PKG_NAME:

keep it simple?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, for the non-complicated pattern matches, I should probably just use equality instead of regex.

Comment thread recipe/install.py Outdated
print(f"Installing {PKG_NAME} to {PREFIX} for {target_platform}")
print("Based on the package name, ", end="")

if re.match(r"^.+\-split$", PKG_NAME):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if re.match(r"^.+\-split$", PKG_NAME):
if PKG_NAME.endswith("-split"):

Comment thread recipe/install.py Outdated
)
for match in sorted(included - excluded):
match = pathlib.Path(match)
if match.exists():

@hmaarrfk hmaarrfk Feb 7, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if match.exists():
if match.is_dir():
continue
if not match.exists():
# runtime error? or just continue?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't recall now why glob was returning paths that did not exist. I think a summary of the things that I want to install (copy) are files and symlinks to files (even if broken). I don't want to copy directories.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the script to explicitly check for file or symlink.

Comment thread recipe/install.py Outdated
if not match.is_dir():
print(relative)
os.makedirs((PREFIX / relative).parent, exist_ok=True)
shutil.copy(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work for synlinks too?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i mean, .so -> .so.0 type of symlinks are quite common.

@carterbox carterbox Feb 7, 2024

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does. Because follow_symlinks=False, the link itself is copied and not the file to which the link points.

https://docs.python.org/3/library/shutil.html#shutil.copy

@hmaarrfk

hmaarrfk commented Feb 7, 2024

Copy link
Copy Markdown
Contributor

I could make it simpler

I think re is likely overused in these cases. startswith, endwith, and straightup equality seem like they suffice in many cases.

@carterbox
carterbox requested a review from hmaarrfk February 7, 2024 18:59
@hmaarrfk

hmaarrfk commented Feb 7, 2024

Copy link
Copy Markdown
Contributor

this looks much easier to use.

There was some discussion on trying to standardize the multi-output names. did you consider that discussion in this script?

@carterbox

carterbox commented Feb 7, 2024

Copy link
Copy Markdown
Member Author

That's a good idea! I remember reading that discussion a while back, but I didn't actively refer to it while writing this script.

Looking at it now, it seems that main conclusions were to use libfoo instead of foo-cpp and to split binaries into a separate package. avif is library only, so there is no avif package. This script conforms to that advice and also the feedback from my attempt at a policy regarding SONAME packages.

@carterbox

carterbox commented Feb 7, 2024

Copy link
Copy Markdown
Member Author

So actually, the one deviation from my script and the output naming discussion is that here the install script assumes the library has a SONAME. In another library without a SONAME, it was suggested that libfoo should not contain headers. The headers should be located in foo-dev or libfoo-dev. But I didn't want to make that change here because it would break downstream recipes. The changes in this PR are backwards compatible.

@hmaarrfk

hmaarrfk commented Feb 7, 2024

Copy link
Copy Markdown
Contributor

ok great. well i think that we considered things to death at this point! ^_^

All good on my side.

@carterbox

Copy link
Copy Markdown
Member Author

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants