Skip to content

Commit 049b326

Browse files
authored
texlive: add a variant to install (or not) the documentation and source files (spack#2771)
1 parent d221c82 commit 049b326

File tree

1 file changed

+15
-1
lines changed
  • repos/spack_repo/builtin/packages/texlive

1 file changed

+15
-1
lines changed

repos/spack_repo/builtin/packages/texlive/package.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ class Texlive(AutotoolsPackage):
115115

116116
build_directory = "spack-build"
117117

118+
variant("doc", default=False, description="Install the documentation files")
119+
variant("src", default=False, description="Install the source files")
120+
118121
def tex_arch(self):
119122
tex_arch = "{0}-{1}".format(platform.machine(), platform.system().lower())
120123
return tex_arch
@@ -155,7 +158,18 @@ def setup_texlive(self):
155158
with working_dir("spack-build"):
156159
make("texlinks")
157160

158-
copy_tree("texlive-{0}-texmf".format(self.version.string), self.prefix)
161+
ignore_doc = "~doc" in self.spec
162+
ignore_src = "~src" in self.spec
163+
164+
ignore = lambda f: (
165+
len(f.split(os.sep)) > 1
166+
and (
167+
(ignore_doc and f.split(os.sep)[1] == "doc")
168+
or (ignore_src and f.split(os.sep)[1] == "source")
169+
)
170+
)
171+
172+
copy_tree("texlive-{0}-texmf".format(self.version.string), self.prefix, ignore=ignore)
159173

160174
# Create and run setup utilities
161175
fmtutil_sys = Executable(join_path(self.prefix.bin, self.tex_arch(), "fmtutil-sys"))

0 commit comments

Comments
 (0)