Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion node/flatpak_node_generator/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,25 @@ class GitSource(PackageSource):
from_: Optional[str]


@dataclass(frozen=True, eq=True)
class NamedGitSource:
package_name: str
git_source: GitSource


@dataclass(frozen=True, eq=True)
class LocalSource(PackageSource):
path: str


@dataclass(frozen=True, eq=True)
class Lockfile:
path: Path
version: int


class Package(NamedTuple):
name: str
version: str
source: PackageSource
lockfile: Path
lockfile: Lockfile
11 changes: 10 additions & 1 deletion node/flatpak_node_generator/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'git': {},
'git+http': {'scheme': 'http'},
'git+https': {'scheme': 'https'},
'git+ssh': {'scheme': 'https'},
}


Expand All @@ -32,6 +33,14 @@ def parse_git_source(self, version: str, from_: Optional[str] = None) -> GitSour
if not new_url.netloc:
path = new_url.path.split('/')
new_url = new_url._replace(netloc=path[0], path='/'.join(path[1:]))
# Replace https://git@github.com:ianstormtaylor/to-camel-case.git
# with https://git@github.com/ianstormtaylor/to-camel-case.git
# for git+ssh URLs
if ':' in new_url.netloc:
netloc_split = new_url.netloc.split(':', 1)
new_url = new_url._replace(
netloc=netloc_split[0], path=f'/{netloc_split[1]}{new_url.path}'
)

return GitSource(
original=original_url.geturl(),
Expand All @@ -40,7 +49,7 @@ def parse_git_source(self, version: str, from_: Optional[str] = None) -> GitSour
from_=from_,
)

def process_lockfile(self, lockfile: Path) -> Iterator[Package]:
def process_lockfile(self, lockfile_path: Path) -> Iterator[Package]:
raise NotImplementedError()


Expand Down
Loading