MCPcopy Create free account
hub / github.com/celer-pkg/celer / Install

Method Install

buildsystems/build_prebuilt.go:87–122  ·  view source on GitHub ↗
(options []string)

Source from the content-addressed store, hash-verified

85}
86
87func (p *prebuilt) Install(options []string) error {
88 // If CMakeLists.txt exists, use CMake to install.
89 if fileio.PathExists(filepath.Join(p.PortConfig.RepoDir, "CMakeLists.txt")) {
90 return p.cmakeInside.Install(options)
91 } else {
92 // For pure prebuilt without CMakeLists.txt, just copy files from repo dir to package dir.
93 if err := os.MkdirAll(p.PortConfig.PackageDir, os.ModePerm); err != nil {
94 return err
95 }
96
97 entities, err := os.ReadDir(p.PortConfig.RepoDir)
98 if err != nil {
99 return err
100 }
101
102 for _, entity := range entities {
103 // .git should not be the installed files.
104 if entity.Name() == ".git" {
105 continue
106 }
107
108 srcPath := filepath.Join(p.PortConfig.RepoDir, entity.Name())
109 destPath := filepath.Join(p.PortConfig.PackageDir, entity.Name())
110 if entity.IsDir() {
111 if err := fileio.CopyDir(srcPath, destPath); err != nil {
112 return err
113 }
114 } else {
115 if err := fileio.CopyFile(srcPath, destPath); err != nil {
116 return err
117 }
118 }
119 }
120 return nil
121 }
122}

Callers

nothing calls this directly

Calls 6

PathExistsFunction · 0.92
CopyDirFunction · 0.92
CopyFileFunction · 0.92
MkdirAllMethod · 0.80
InstallMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected