Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Filter autogen files (such as Paths_foo) from exposed-modules when running sdist #1110

Merged
merged 1 commit into from

3 participants

Jeremy Shaw Johan Tibell Duncan Coutts
Jeremy Shaw

...g sdist. Previously autogen files were only filtered from other-modules.

Jeremy Shaw stepcut Filter autogen files (such as Path_foo) from exposed-modules when run…
…ning sdist. Previously autogen files were only filtered from other-modules.
d273465
Johan Tibell
Owner

Could you please remind me why this is needed. Is it because we're supposed to build that module on the user's machine, not when creating the sdist?

Jeremy Shaw

Yes. The Paths_foo module is generated by the 'cabal build' phase. If you list Paths_foo in the exposed-modules section and run the sdist target with out this patch you get:

$ cabal sdist
Warning: Cannot run preprocessors. Run 'configure' command first.
Building source dist for happstack-fay-0.1.0.0...
cabal: Error: Could not find module: Paths_happstack_fay with any suffix:
["gc","chs","hsc","x","y","ly","cpphs","hs","lhs"]

When I asked dcoutts about this, he thought that we were already filtering Paths_* from exposed-modules list, but then realized that it was only filtered by the other-modules list.

With my patch applied, sdist succeeds. I can then copy the the generated .tar.gz to another directory, extract it, and successfully build the package. That empirically leads me to believe it is probably the right thing to do?

Johan Tibell tibbe merged commit d273465 into from
Duncan Coutts
Collaborator

@stepcut sorry, confusion after our previous conversation. I'd started writing the same patch. I see yours is just as good as mine so that's all ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 14, 2012
  1. Jeremy Shaw

    Filter autogen files (such as Path_foo) from exposed-modules when run…

    stepcut authored
    …ning sdist. Previously autogen files were only filtered from other-modules.
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 4 deletions.
  1. +8 −4 Cabal/Distribution/Simple/SrcDist.hs
12 Cabal/Distribution/Simple/SrcDist.hs
View
@@ -244,7 +244,7 @@ prepareTree verbosity pkg_descr0 mb_lbi distPref targetDir pps = do
-- pre-processors and include those generated files
case mb_lbi of
Just lbi | not (null pps) -> do
- let lbi' = lbi{ buildDir = targetDir </> buildDir lbi }
+ let lbi' = lbi{ buildDir = targetDir </> buildDir lbi }
withComponentsLBI pkg_descr lbi' $ \c _ ->
preprocessComponent pkg_descr c lbi' True verbosity pps
_ -> return ()
@@ -262,9 +262,13 @@ prepareTree verbosity pkg_descr0 mb_lbi distPref targetDir pps = do
installOrdinaryFile verbosity descFile (targetDir </> descFile)
where
- pkg_descr = mapAllBuildInfo filterAutogenModule pkg_descr0
- filterAutogenModule bi = bi {
- otherModules = filter (/=autogenModule) (otherModules bi)
+ pkg_descr = mapLib filterAutogenModuleLib $ mapAllBuildInfo filterAutogenModuleBI pkg_descr0
+ mapLib f pkg = pkg { library = fmap f (library pkg) }
+ filterAutogenModuleLib lib = lib {
+ exposedModules = filter (/=autogenModule) (exposedModules lib)
+ }
+ filterAutogenModuleBI bi = bi {
+ otherModules = filter (/=autogenModule) (otherModules bi)
}
autogenModule = autogenModuleName pkg_descr0
Something went wrong with that request. Please try again.