Skip to content

Commit

Permalink
feat: package webshop app
Browse files Browse the repository at this point in the history
  • Loading branch information
blaggacao committed Mar 10, 2024
1 parent 27adf1a commit fd6089e
Show file tree
Hide file tree
Showing 8 changed files with 174 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/sources.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ let

applyInputPatches = name: attrs:
{
webshop =
attrs
// {
src = applyPatches {
name = "webshop-source";
inherit (attrs) src;
patches = [
./sources/webshop-pr-99-flit-core.patch
];
};
};
frappe =
attrs
// {
Expand Down
5 changes: 5 additions & 0 deletions apps/sources/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ source = "github"
branch = "version-15" # no proper releases
github = "frappe/payments"

[webshop]
source = "github"
branch = "version-15" # no proper releases
github = "frappe/webshop"

[wiki]
source = "github"
branch = "master" # Latest release (Wiki v2.0.1) is for frappe 14
Expand Down
1 change: 1 addition & 0 deletions apps/sources/newver.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"gameplan": "20240206.065338",
"insights": "20240301.064651",
"payments": "20240123.122024",
"webshop": "20240125.060731",
"wiki": "20240121.050421"
}
1 change: 1 addition & 0 deletions apps/sources/oldver.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"gameplan": "20240206.065338",
"insights": "20240301.064651",
"payments": "20240123.122024",
"webshop": "20240125.060731",
"wiki": "20240121.050421"
}
106 changes: 106 additions & 0 deletions apps/sources/webshop-pr-99-flit-core.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
From 5f5ef2133bdc8faf866b81c408bba22eba908857 Mon Sep 17 00:00:00 2001
From: David <dgx.arnold@gmail.com>
Date: Sun, 10 Mar 2024 23:13:30 +0100
Subject: [PATCH] chore: use flit-core build as other frappe apps

---
MANIFEST.in | 18 ------------------
pyproject.toml | 26 ++++++++++++++++++++++++++
requirements.txt | 1 -
setup.py | 19 -------------------
4 files changed, 26 insertions(+), 38 deletions(-)
delete mode 100644 MANIFEST.in
create mode 100644 pyproject.toml
delete mode 100644 requirements.txt
delete mode 100644 setup.py

diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index 47fefeae2c..0000000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,18 +0,0 @@
-include MANIFEST.in
-include requirements.txt
-include *.json
-include *.md
-include *.py
-include *.txt
-recursive-include webshop *.css
-recursive-include webshop *.csv
-recursive-include webshop *.html
-recursive-include webshop *.ico
-recursive-include webshop *.js
-recursive-include webshop *.json
-recursive-include webshop *.md
-recursive-include webshop *.png
-recursive-include webshop *.py
-recursive-include webshop *.svg
-recursive-include webshop *.txt
-recursive-exclude webshop *.pyc
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000000..acc3fbe02d
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,26 @@
+[project]
+name = "webshop"
+authors = [
+ { name = "Frappe Technologies Pvt. Ltd.", email = "contact@frappe.io"}
+]
+description = "Open Source eCommerce Platform"
+requires-python = ">=3.10"
+readme = "README.md"
+dynamic = ["version"]
+dependencies = []
+
+[build-system]
+requires = ["flit_core >=3.4,<4"]
+build-backend = "flit_core.buildapi"
+
+[tool.black]
+line-length = 99
+
+[tool.isort]
+line_length = 99
+multi_line_output = 3
+include_trailing_comma = true
+force_grid_wrap = 0
+use_parentheses = true
+ensure_newline_before_comments = true
+indent = "\t"
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 7668191f9c..0000000000
--- a/requirements.txt
+++ /dev/null
@@ -1 +0,0 @@
-# frappe -- https://github.com/frappe/frappe is installed via 'bench init'
\ No newline at end of file
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 9f7bc1b13b..0000000000
--- a/setup.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from setuptools import setup, find_packages
-
-with open("requirements.txt") as f:
- install_requires = f.read().strip().split("\n")
-
-# get version from __version__ variable in webshop/__init__.py
-from webshop import __version__ as version
-
-setup(
- name="webshop",
- version=version,
- description="Open Source eCommerce Platform",
- author="Frappe Technologies Pvt. Ltd.",
- author_email="contact@frappe.io",
- packages=find_packages(),
- zip_safe=False,
- include_package_data=True,
- install_requires=install_requires
-)
16 changes: 16 additions & 0 deletions apps/sources/webshop.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
pname = "webshop";
version = "20240125.060731";
meta = {
url = "https://github.com/frappe/webshop/commit/bebfee123fb0a9dd2ce5f7c41d63fc01e1375990";
description = "Sources for webshop (20240125.060731)";
};
src = builtins.fetchTree {
type = "github";
owner = "frappe";
repo = "webshop";
narHash = "sha256-y/zWxsR6as3nEI3jgCrz1BjWcVcqzxBm11kC596yg0E=";
rev = "bebfee123fb0a9dd2ce5f7c41d63fc01e1375990";
};
passthru = builtins.fromJSON ''{}'';
}
1 change: 1 addition & 0 deletions src/overlays/frappe/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ in {
ecommerce-integrations = callPackage ./ecommerce-integrations.nix {};
payments = callPackage ./payments.nix {};
wiki = callPackage ./wiki.nix {};
webshop = callPackage ./webshop.nix {};
});
}
33 changes: 33 additions & 0 deletions src/overlays/frappe/webshop.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
appSources,
lib,
buildPythonPackage,
flit-core,
pythonRelaxDepsHook,
extractFrappeMeta,
}:
buildPythonPackage rec {
inherit
(extractFrappeMeta src)
pname
version
format
;

inherit (appSources.webshop) src passthru;

nativeBuildInputs = [
pythonRelaxDepsHook
flit-core
];

# would require frappe, but since frappe is almost certainly customized,
# we don't include it here / TODO: decide if we may actually add it?
# pythonImportsCheck = ["webshop"];

meta = with lib; {
description = "Frappe webshop is an Open Source eCommerce Platform";
homepage = "https://github.com/frappe/webshop.git";
license = licenses.gpl3;
};
}

0 comments on commit fd6089e

Please sign in to comment.