From dfdd1bbb340a7cd20db6e1ed16527ce4c80ec50c Mon Sep 17 00:00:00 2001 From: Benson Chu Date: Sat, 26 Apr 2025 19:16:13 -0500 Subject: [PATCH] I think this is packaged correctly --- newfol/__init__.py | 0 {lib/newfol => newfol}/database.py | 0 {lib/newfol => newfol}/exception.py | 0 {lib/newfol => newfol}/filemanip.py | 0 {lib/newfol => newfol}/main.py | 0 newfol => newfol/newfol.py | 6 ++++-- {lib/newfol => newfol}/version.py | 0 setup.py | 14 ++++++++++++++ shell.nix | 22 ++++++++++++++++++++++ 9 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 newfol/__init__.py rename {lib/newfol => newfol}/database.py (100%) rename {lib/newfol => newfol}/exception.py (100%) rename {lib/newfol => newfol}/filemanip.py (100%) rename {lib/newfol => newfol}/main.py (100%) rename newfol => newfol/newfol.py (92%) rename {lib/newfol => newfol}/version.py (100%) create mode 100644 setup.py create mode 100644 shell.nix diff --git a/newfol/__init__.py b/newfol/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/lib/newfol/database.py b/newfol/database.py similarity index 100% rename from lib/newfol/database.py rename to newfol/database.py diff --git a/lib/newfol/exception.py b/newfol/exception.py similarity index 100% rename from lib/newfol/exception.py rename to newfol/exception.py diff --git a/lib/newfol/filemanip.py b/newfol/filemanip.py similarity index 100% rename from lib/newfol/filemanip.py rename to newfol/filemanip.py diff --git a/lib/newfol/main.py b/newfol/main.py similarity index 100% rename from lib/newfol/main.py rename to newfol/main.py diff --git a/newfol b/newfol/newfol.py similarity index 92% rename from newfol rename to newfol/newfol.py index c65f388..efb6662 100755 --- a/newfol +++ b/newfol/newfol.py @@ -1,7 +1,6 @@ #! /usr/bin/python3 import sys -sys.path.insert(0, sys.path[0] + "/lib") import gettext import locale @@ -12,7 +11,7 @@ import newfol.main from gettext import gettext as _ from newfol.exception import LocaleError -if __name__ == '__main__': +def main(): try: locale.setlocale(locale.LC_ALL, '') gettext.bindtextdomain('newfol') @@ -28,3 +27,6 @@ if __name__ == '__main__': except newfol.exception.FilemanipError as e: sys.stderr.write(_("E: %s\n") % e) sys.exit(2) + +if __name__ == "__main__": + main() diff --git a/lib/newfol/version.py b/newfol/version.py similarity index 100% rename from lib/newfol/version.py rename to newfol/version.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..fe21e62 --- /dev/null +++ b/setup.py @@ -0,0 +1,14 @@ +import setuptools + +setuptools.setup( + name = "NewFol", + version = "0.0.1", + author = "Brian", + description = "Database program for Peter Hodgson", + scripts = ["newfol/newfol.py"], + entry_points = { + 'console_scripts': [ + 'newfol = newfol.__main__:main' + ] + } +) diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..7c7052e --- /dev/null +++ b/shell.nix @@ -0,0 +1,22 @@ +with import {}; +let + pythonPackages = pkgs.python3Packages; + newfol = + pythonPackages.buildPythonPackage rec { + name = "newfol"; + src = ./.; + propagatedBuildInputs = [ + pythonPackages.urwid + ]; + + postInstall = '' + mv -v $out/bin/newfol.py $out/bin/newfol + ''; + }; +in +pkgs.mkShell { + buildInputs = with pythonPackages; [ + # newfol + ]; + packages = [ newfol ]; +}