(cfg *Config)
| 71 | } |
| 72 | |
| 73 | func (m *Manager) CreateFilesForConfig(cfg *Config) error { |
| 74 | virtenvPath := filepath.Join(m.ProjectDir(), VirtenvPath) |
| 75 | pkg := cfg.Source |
| 76 | locked := m.lockfile.Packages[pkg.LockfileKey()] |
| 77 | |
| 78 | name := pkg.CanonicalName() |
| 79 | |
| 80 | // Always create this dir because some plugins depend on it. |
| 81 | if err := createDir(filepath.Join(virtenvPath, name)); err != nil { |
| 82 | return err |
| 83 | } |
| 84 | |
| 85 | slog.Debug("creating files for package", "pkg", pkg) |
| 86 | for filePath, contentPath := range cfg.CreateFiles { |
| 87 | if !m.shouldCreateFile(locked, filePath) { |
| 88 | continue |
| 89 | } |
| 90 | |
| 91 | dirPath := filepath.Dir(filePath) |
| 92 | if contentPath == "" { |
| 93 | dirPath = filePath |
| 94 | } |
| 95 | if err := createDir(dirPath); err != nil { |
| 96 | return errors.WithStack(err) |
| 97 | } |
| 98 | |
| 99 | if contentPath == "" { |
| 100 | continue |
| 101 | } |
| 102 | |
| 103 | if err := m.createFile(pkg, filePath, contentPath, virtenvPath); err != nil { |
| 104 | return err |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | return nil |
| 109 | } |
| 110 | |
| 111 | func (m *Manager) UpdateLockfileVersion(cfg *Config) error { |
| 112 | pkg := cfg.Source |
no test coverage detected