Skip to content

Commit

Permalink
- Remove isProjectInstallation var.
Browse files Browse the repository at this point in the history
  • Loading branch information
boscojwho committed Aug 25, 2024
1 parent 1fe7262 commit c1d0ee9
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 18 deletions.
9 changes: 0 additions & 9 deletions PyTerm/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ struct ContentView: View {
if let selectedPip = contentSelectionPreferences.selectedPip {
PipView(
pipInstallation: selectedPip,
isProjectInstallation: hasVenv(),
selectedPackage: $contentSelection.selectedPackage
)
.id(selectedPip)
Expand Down Expand Up @@ -90,7 +89,6 @@ struct ContentView: View {
if let selectedPackage = contentSelectionPreferences.selectedPackage {
PipPackageView(
pipInstallation: selectedPip,
isProjectInstallation: hasVenv(),
package: selectedPackage
)
.id(selectedPackage)
Expand Down Expand Up @@ -159,13 +157,6 @@ struct ContentView: View {
return true
}
}

private func hasVenv() -> Bool {
guard let selectedPip = contentSelectionPreferences.selectedPip else { return false }
return VenvFinder(projectUrl: selectedPip)
.findVenv()
.isEmpty == false
}
}

#Preview {
Expand Down
3 changes: 0 additions & 3 deletions PyTerm/PipClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,14 @@ extension PipListResponse {
@Observable
final class PipClient {
let installationPath: URL
let isProjectInstallation: Bool
let pipExecutable: String?
private var shellClient: ShellClient
init(
installationPath: URL,
isProjectInstallation: Bool,
pipExecutable: String?,
shellClient: ShellClient
) {
self.installationPath = installationPath
self.isProjectInstallation = isProjectInstallation
self.pipExecutable = pipExecutable
self.shellClient = shellClient
}
Expand Down
3 changes: 0 additions & 3 deletions PyTerm/PipPackageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,12 @@ struct PipPackageView: View {
@State private var pipClient: PipClient
init(
pipInstallation: URL,
isProjectInstallation: Bool,
package: PipListResponse
) {
self.package = package
_pipClient = .init(
wrappedValue: .init(
installationPath: pipInstallation,
isProjectInstallation: isProjectInstallation,
pipExecutable: pipInstallation.lastPathComponent,
shellClient: .init(currentDirectoryPath: pipInstallation.deletingLastPathComponent().path())
)
Expand Down Expand Up @@ -236,7 +234,6 @@ struct PipPackageView: View {
#Preview {
PipPackageView(
pipInstallation: .init(filePath: "/usr/bin/pip"),
isProjectInstallation: false,
package: .mock()
)
}
3 changes: 0 additions & 3 deletions PyTerm/PipView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ struct PipView: View {
@Binding var selectedPackage: PipListResponse?
init(
pipInstallation: URL,
isProjectInstallation: Bool,
selectedPackage: Binding<PipListResponse?>
) {
self.pipInstallation = pipInstallation
_pipClient = .init(
wrappedValue: .init(
installationPath: pipInstallation,
isProjectInstallation: isProjectInstallation,
pipExecutable: pipInstallation.lastPathComponent,
shellClient: .init(currentDirectoryPath: pipInstallation.deletingLastPathComponent().path())
)
Expand Down Expand Up @@ -99,7 +97,6 @@ struct PipView: View {
#Preview {
PipView(
pipInstallation: .init(filePath: "/usr/bin/pip"),
isProjectInstallation: false,
selectedPackage: .constant(nil)
)
}

0 comments on commit c1d0ee9

Please sign in to comment.