Skip to content

[node] support git sources #382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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 @@ -123,13 +123,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 @@ -16,6 +16,7 @@
'git': {},
'git+http': {'scheme': 'http'},
'git+https': {'scheme': 'https'},
'git+ssh': {'scheme': 'https'},
}


Expand All @@ -33,6 +34,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://[email protected]:ianstormtaylor/to-camel-case.git
# with https://[email protected]/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 @@ -41,7 +50,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