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

Figure out how to support sdist command #2

Open
chshersh opened this issue Mar 19, 2020 · 5 comments
Open

Figure out how to support sdist command #2

chshersh opened this issue Mar 19, 2020 · 5 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@chshersh
Copy link
Contributor

No description provided.

@chshersh chshersh added enhancement New feature or request question Further information is requested labels Mar 19, 2020
@hasufell
Copy link
Contributor

hasufell commented Mar 22, 2020

This is a bigger problem than it sounds, imo, because cabal install uses sdist.

@phadej any ideas?

@hasufell
Copy link
Contributor

I have a crazy idea... what if autopack would add the exposed modules during setup to the cabal file :>

It could be guarded with an environment variable, so it doesn't clutter the git history for non-sdist workflows. Writing to a file is always problematic, requires committing it, can fail etc, so I think it would be reasonable to have this optional.

@vrom911
Copy link
Member

vrom911 commented Mar 27, 2020

Interesting idea, though I am not sure that it would work as I am not sure on which stage sdist reads cabal file.

I guess we need to investigate more on the UserHooks data type. There is the preCopy field in there which may be something to do with sdist. So probably we can just override behaviour there as well 🤔 What do you think @chshersh ?

@chshersh
Copy link
Contributor Author

@vrom911, I agree with your solution. Ideally, I'd love to see something like sdistHook in UserHooks, but if it's already possible to reuse one of the existing hooks to achieve the desired behaviour, it's worth investigating.

@hasufell
Copy link
Contributor

hasufell commented Mar 28, 2020

Well, I made it work with: https://www.haskell.org/cabal/users-guide/developing-packages.html#pkg-field-extra-source-files

So if you have hs-source-dirs: lib, then you just add extra-source-files: lib/**/*.hs. But that still has the problem that it circumvents the current .cabal file standard. I think that needs to be discussed with cabal maintainers.

As autopack doesn't really conflict with cabal-fmt, my current workflow is basically: use autopack with the above hack. Once I need to upload to hackage, I make sure my .cabal file has the modules listed explicitly (via cabal-fmt or so), while still keeping autopack in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants