diff --git a/.gitignore b/.gitignore index a39c9e9..3f835b6 100644 --- a/.gitignore +++ b/.gitignore @@ -107,4 +107,4 @@ ENV/ ### Cutome additions ### # ignore rpm directory -rpm +_rpm diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index bb9baf0..552a811 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -75,7 +75,7 @@ Ready to contribute? Here's how to set up `fcust` for local development. 4. From the root of the repository create a python virtual environment to use for our project. Install the project in editable mode along with developer dependencies. :: - $ python3 -m venv venv + $ python3 -m venv venv --system-site-packages $ source venv/bin/activate (venv) $ pip install -e .[dev] diff --git a/HISTORY.rst b/HISTORY.rst index 1f9d56e..e482247 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,12 @@ History ======= +1.0.1 (2022-12-28) +------------------- + +* Updated package for Fedora 37. +* Updated package to use pyproject.toml. + 1.0.0 (2021-11-21) ------------------- diff --git a/MANIFEST.in b/MANIFEST.in index 48b250a..07d3825 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,7 +3,6 @@ include CONTRIBUTING.rst include HISTORY.rst include LICENSE include README.rst -include requirements.txt include Dockerfile exclude .yamllint exclude fcust.spec @@ -16,5 +15,4 @@ recursive-exclude * __pycache__ recursive-exclude * *.py[co] recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif -include docs/_build/man/fcust.1 recursive-exclude docs/_build/html * diff --git a/Makefile b/Makefile index 83a8727..5826a41 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and clean-build: ## remove build artifacts rm -fr build/ rm -fr dist/ - rm -fr rpm/* + rm -fr _rpm/* rm -fr .eggs/ find . -name '*.egg-info' -exec rm -fr {} + find . -name '*.egg' -exec rm -f {} + @@ -94,17 +94,18 @@ dist: clean ## builds source and wheel package install: clean ## install the package to the active Python's site-packages python setup.py install -fedpkg: # build package for Fedora (35) +fedpkg: # build package for Fedora (37) # build package locally make dist # remove all previous artifacts - rm -rf ./rpm/* + rm -rf _rpm/* # move new package to rpm folder - mv dist/fcust-*.tar.gz ./rpm/ + cp dist/fcust-*.tar.gz ./_rpm/ # add needed spec file - cp fcust.spec ./rpm/ + cp fcust.spec ./_rpm/ + cp fcust_source.tar ./_rpm/ # create rpm packages - fedpkg --release f35 --path ./rpm local + fedpkg --release f37 --path ./_rpm local echo "RPM Files Built!" # check rpm packages - fedpkg --release f35 --path ./rpm lint + fedpkg --release f37 --path ./_rpm lint diff --git a/docs/_build/man/fcust.1 b/docs/_build/man/fcust.1 deleted file mode 100644 index 02dbccf..0000000 --- a/docs/_build/man/fcust.1 +++ /dev/null @@ -1,595 +0,0 @@ -.\" Man page generated from reStructuredText. -. -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.TH "FCUST" "1" "Nov 21, 2021" "1.0.0" "Folder Custodian" -.SH NAME -fcust \- Folder Custodian Documentation -.SH FOLDER CUSTODIAN -\fI\%\fP\fI\%\fP\fI\%Documentation Status\fP\fI\%Updates\fP -.sp -Linux Common Folder Custodian -.INDENT 0.0 -.IP \(bu 2 -Free software: GNU General Public License v3 -.IP \(bu 2 -Documentation: \fI\%Read the Docs\fP -.UNINDENT -.SS Why? -.sp -The family computer runs Fedora, has many users and we want to share some files with each other. -To achive this we create a shared common folder. -This package solves the problems that come with our use case. -.SS Features -.sp -This package is intended to perform maintenance over a folder shared across many users in a Fedora Workstation. -The folder should belong to a group for which all users are members. -.INDENT 0.0 -.IP \(bu 2 -Go through a folder’s content and enforce common group ownership. -.IP \(bu 2 -Go through a folder’s content and enforce common group read and write permissions as -well as set groupid sticky bit. -.IP \(bu 2 -Provide a command line command with sane defaults for enforcing common folder group ownership -and permissions. -.IP \(bu 2 -Write logs to \fB/tmp/fcust/$USER.log\fP\&. -.IP \(bu 2 -Provides user systemd service to periodically enforce common folder group ownership -and permissions. Runs on user log out. -.UNINDENT -.sp -The key problem this package intends to solve is that files moved from one location to another do not inherit -proper permissions in the commonly used folder and therefore when another user tries to access them they encounter -problems. -.SS Quick Start Guide -.INDENT 0.0 -.IP \(bu 2 -Install fcust: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ sudo dnf copr enable iolaum/fcust -$ sudo dnf install fcust -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -Manually create a common group and add as members the users that will have access to it. -For example: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ sudo groupadd family -$ sudo usermod \-a \-G family user1 -$ sudo usermod \-a \-G family user1 -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -Create that folder and assign proper permissions: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ mkdir /path/to/common/folder/ -$ chown :family /path/to/common/folder/ -$ chmod 2775 /path/to/common/folder/ -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -Setup fcust: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ fcust setup /path/to/common/folder/ -$ fcust activate -.ft P -.fi -.UNINDENT -.UNINDENT -.IP \(bu 2 -In order to run fcust manually on a properly permissioned common folder run: -.INDENT 2.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ fcust run /path/to/common/folder/ -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.SH INSTALLATION -.SS Fedora COPR Repositories -.sp -The recommended way to install Folder Custodian is through the Fedora Copr repositories: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ sudo dnf copr enable iolaum/fcust -$ sudo dnf install fcust -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -This is the preferred method to install Folder Custodian, -as it will always install the most recent stable release. -.SS Python Packaging Index -.sp -Alternatively Folder Custodian can be installed as a python package: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ pip install fcust -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -If you don’t have \fI\%pip\fP installed, this \fI\%Python installation guide\fP can guide -you through the process. -.SS From sources -.sp -The sources for Folder Custodian can be downloaded from the \fI\%Github repo\fP\&. -.sp -For more information follow the Contributing page. -.SH FCUST -.SS fcust package -.SS Submodules -.SS fcust.cli module -.sp -Console script for fcust. -.SS fcust.fcust module -.sp -Main module. -.INDENT 0.0 -.TP -.B class fcust.fcust.CommonFolder(folder_path: pathlib.PosixPath, common_group: str = \(aq\(aq) -Bases: \fBobject\fP -.sp -Main class regarding management of a folder that is commonly used across many users. -.INDENT 7.0 -.IP \(bu 2 -The class creates a logfile at /tmp/fcust/$USER.log -.IP \(bu 2 -By default the class assumes that the root of the common folder is configured -correctly and then tries to enforce appropriate permissions. -.UNINDENT -.INDENT 7.0 -.TP -.B Parameters -.INDENT 7.0 -.IP \(bu 2 -\fBfolder_path\fP – Path where the common folder is located. -.IP \(bu 2 -\fBcommon_group\fP – Group name regarding the common folder. -If not passed the existing group of the folder will be assumed to be the proper folder. -.UNINDENT -.UNINDENT -.INDENT 7.0 -.TP -.B enforce_permissions() -We read the contents of a specified directory and enforce unix permissions. -.sp -Files should have 664 permissions -Folders should have 2775 permisions (ie also setguid bit) -Group should be common golder’s group. -.sp -The function only changes permissions if the user is owner of the relevant resource. -This is done to avoid the need for root access, but requires the function to be -run by all the users sharing the common folder. -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B fcust.fcust.create_logger(cgroup: str, lpath: str = \(aq/tmp/fcust/\(aq) -Function that creates a modified logger to cater fcust functionality. -.INDENT 7.0 -.TP -.B Parameters -\fBcgroup\fP – group ownership of the main directory -.UNINDENT -.UNINDENT -.SS fcust.service module -.sp -Utilities for Folder Custodian Service. -.INDENT 0.0 -.TP -.B fcust.service.activate_service() -After a fcust setup is run we need to activate the service we installed. -.UNINDENT -.INDENT 0.0 -.TP -.B fcust.service.create_fcust_service_unit(folder_path: pathlib.PosixPath, unit_path: pathlib.PosixPath) -Create a systemd user unit for folder cutodian. -Use predefined template and modify where needed. -.sp -We want the service to run when the user logs out so that all the changes -they made are fixed if needed. We consult the following sources -to create the appropriate systemd service template: -.INDENT 7.0 -.IP \(bu 2 -\fI\%https://wiki.archlinux.org/index.php/Systemd/User\fP -.IP \(bu 2 -\fI\%https://superuser.com/questions/1037466/\fP -how\-to\-start\-a\-systemd\-service\-after\-user\-login\-and\-stop\-it\-before\-user\-logout/1269158 -.IP \(bu 2 -\fI\%https://askubuntu.com/questions/293312/\fP -execute\-a\-script\-upon\-logout\-reboot\-shutdown\-in\-ubuntu/796157#796157 -.UNINDENT -.INDENT 7.0 -.TP -.B Parameters -.INDENT 7.0 -.IP \(bu 2 -\fBfolder_path\fP – Path where the common folder is located. -.IP \(bu 2 -\fBunit_path\fP – Path where the common folder is located. -.UNINDENT -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B fcust.service.create_user_unit_path(create_folder: bool = False) -We want to add a systemd user unit to run fcust on certain times. In order to do -this we want to crete a unit at a proper location. According to: -\fI\%https://wiki.archlinux.org/index.php/Systemd/User\fP -our options are: -.INDENT 7.0 -.IP \(bu 2 -/usr/lib/systemd/user/: -.sp -where units provided by installed packages belong. -.IP \(bu 2 -~/.local/share/systemd/user/ -.sp -where units of packages that have been installed in the home directory belong. -.IP \(bu 2 -/etc/systemd/user/ -.sp -where system\-wide user units are placed by the system administrator. -.IP \(bu 2 -~/.config/systemd/user/ -.sp -where the user puts their own units. -.UNINDENT -.sp -We opt to use the latter choice. -.sp -This function constructs the proper systemd user unit path where it will be installed. -It also creates the necessary folder if it doesn’t exist. -.INDENT 7.0 -.TP -.B Parameters -\fBcreate_folder\fP – If true create the folder that the unit service will be installed. -.TP -.B Returns -Path object for the location the unit service will be installed. -.UNINDENT -.UNINDENT -.INDENT 0.0 -.TP -.B fcust.service.deactivate_service() -Deactivate a running fcust service. -.UNINDENT -.SS Module contents -.sp -Top\-level package for Folder Custodian. -.SH CONTRIBUTING -.sp -Contributions are welcome, and they are greatly appreciated! Every little bit -helps, and credit will always be given. -.sp -You can contribute in many ways: -.SS Types of Contributions -.SS Report Bugs -.sp -Report bugs at the project’s \fI\%issues page\fP\&. -.sp -If you are reporting a bug, please include: -.INDENT 0.0 -.IP \(bu 2 -Your operating system name and version. -.IP \(bu 2 -Any details about your local setup that might be helpful in troubleshooting. -.IP \(bu 2 -Detailed steps to reproduce the bug. -.UNINDENT -.SS Fix Bugs -.sp -Look through the GitHub issues for bugs. Anything tagged with “bug” and “help -wanted” is open to whoever wants to implement it. -.SS Implement Features -.sp -Look through the GitHub issues for features. Anything tagged with “enhancement” -and “help wanted” is open to whoever wants to implement it. -.SS Write Documentation -.sp -Folder Custodian could always use more documentation, whether as part of the -official Folder Custodian docs, in docstrings, or even on the web in blog posts, -articles, and such. -.SS Submit Feedback -.sp -The best way to send feedback is to file an issue at the project’s \fI\%issues page\fP\&. -.sp -If you are proposing a feature: -.INDENT 0.0 -.IP \(bu 2 -Explain in detail how it would work. -.IP \(bu 2 -Keep the scope as narrow as possible, to make it easier to implement. -.IP \(bu 2 -Remember that this is a volunteer\-driven project, and that contributions -are welcome :) -.UNINDENT -.SS Get Started! -.sp -Ready to contribute? Here’s how to set up \fIfcust\fP for local development. -.INDENT 0.0 -.IP 1. 3 -Fork the \fIfcust\fP repo on GitHub. -.IP 2. 3 -Install Required packages. -.INDENT 3.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ sudo dnf install python3\-pip python3\-wheel make git findutils hadolint -.ft P -.fi -.UNINDENT -.UNINDENT -.IP 3. 3 -Clone your fork locally. -.INDENT 3.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ git clone git@github.com:your_name_here/fcust.git -$ cd fcust -.ft P -.fi -.UNINDENT -.UNINDENT -.IP 4. 3 -From the root of the repository create a python virtual environment to use for our project. -Install the project in editable mode along with developer dependencies. -.INDENT 3.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ python3 \-m venv venv -$ source venv/bin/activate -(venv) $ pip install \-e .[dev] -.ft P -.fi -.UNINDENT -.UNINDENT -.IP 5. 3 -Create a branch for local development. -.INDENT 3.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ git checkout \-b name\-of\-your\-bugfix\-or\-feature -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Now you can make your changes locally. -.IP 6. 3 -When you’re done making changes, check that your changes pass code quality checks -and tests. -.INDENT 3.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ make code -$ make test -.ft P -.fi -.UNINDENT -.UNINDENT -.IP 7. 3 -Commit your changes and push your branch to GitHub. -.INDENT 3.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ git add . -$ git commit \-m "Your detailed description of your changes." -$ git push origin name\-of\-your\-bugfix\-or\-feature -.ft P -.fi -.UNINDENT -.UNINDENT -.IP 8. 3 -Submit a pull request through the GitHub website. -.UNINDENT -.SS Pull Request Guidelines -.sp -Before you submit a pull request, check that it meets these guidelines: -.INDENT 0.0 -.IP 1. 3 -The pull request should include tests. -.IP 2. 3 -If the pull request adds functionality, the docs should be updated. Put -your new functionality into a function with a docstring, and add the -feature to the list in README.rst. -.IP 3. 3 -The pull request should work for Python 3.9, for PyPy and Fedora. Check -the \fI\%relevant GitHub Actions page\fP and make sure that the tests pass. -.UNINDENT -.SS Developing on Fedora Silverblue -.sp -If developing on Fedora Silverblue the following set up is suggested: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -# Crete new toolbox -$ toolbox create dev -# Add toolbox entry to /etc/hosts to avoid -# warning: Could not canonicalize hostname: toolbox -$ sudo nano /etc/hosts -# 127.0.0.1 ... toolbox -$ toolbox enter dev -# Following commands are inside the toolbox -$ sudo groupadd family -$ sudo usermod \-a \-G family $USER -# exit and re\-enter toolbox container for changes to take effect. -$ cd $source_code_root_repository -$ sudo dnf install make fedpkg python3\-wheel python3\-devel python3\-sphinx python3\-click hadolint -$ make code -$ make test -$ make fedpkg -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Deploying -.sp -A reminder for the maintainers on how to deploy. -Make sure all your changes are committed. -Then run: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ bump2version patch # possible: major / minor / patch -$ git push -$ git push \-\-tags -.ft P -.fi -.UNINDENT -.UNINDENT -.sp -Then make sure to update \fIHISTORY.rst\fP and the \fIfcust.spec\fP changelog section. Afterwards -commit and push to Github. -.sp -If all checks pass manually deploy to PyPI. Merge to the release branch to automatically trigger a COPR build. -.SH CREDITS -.SS Development Lead -.INDENT 0.0 -.IP \(bu 2 -Nikolaos Perrakis <\fI\%nikperrakis@gmail.com\fP> -.UNINDENT -.SS Contributors -.sp -This package was initalised with \fI\%Cookiecutter\fP and the \fI\%audreyr/cookiecutter\-pypackage\fP project template. -.SH HISTORY -.SS 1.0.0 (2020\-11\-21) -.INDENT 0.0 -.IP \(bu 2 -Updated package for Fedora 35. -.IP \(bu 2 -Releasing production version. -.UNINDENT -.SS 0.1.1 (2020\-11\-22) -.INDENT 0.0 -.IP \(bu 2 -Added ability to see recent service logs. -.IP \(bu 2 -Releasing beta version of feature complete package. -.UNINDENT -.SS 0.0.14 (2020\-11\-10) -.INDENT 0.0 -.IP \(bu 2 -Adding functionality to create, start and stop systemd user service -.UNINDENT -.SS 0.0.10 (2020\-11\-07) -.INDENT 0.0 -.IP \(bu 2 -F33 release -.IP \(bu 2 -Minor Documentation update -.UNINDENT -.SS 0.0.9 (2020\-10\-13) -.INDENT 0.0 -.IP \(bu 2 -Hotfixed log access path bug -.UNINDENT -.SS 0.0.8 (2020\-10\-10) -.INDENT 0.0 -.IP \(bu 2 -Draft packaging as a fedora 32 rpm package -.UNINDENT -.SS 0.0.5 (2020\-10\-07) -.INDENT 0.0 -.IP \(bu 2 -Added command line command for folder contents permission enformcement -.IP \(bu 2 -Added documentation -.UNINDENT -.SS 0.0.3 (2020\-10\-05) -.INDENT 0.0 -.IP \(bu 2 -Alpha version with common folder enformcement functionality. -.UNINDENT -.INDENT 0.0 -.IP \(bu 2 -genindex -.IP \(bu 2 -modindex -.IP \(bu 2 -search -.UNINDENT -.SH AUTHOR -Nikolaos Perrakis -.SH COPYRIGHT -2020, Nikolaos Perrakis -.\" Generated by docutils manpage writer. -. diff --git a/fcust.spec b/fcust.spec index bdfbb91..dd21743 100644 --- a/fcust.spec +++ b/fcust.spec @@ -1,13 +1,16 @@ %global pypi_name fcust Name: %{pypi_name} -Version: 1.0.0 -Release: 2%{?dist} +Version: 1.0.1 +Release: 1%{?dist} Summary: Linux Common Folder Custodian License: GPLv3+ URL: https://github.com/Iolaum/fcust -Source0: %{URL}/archive/refs/tags/v%{version}.tar.gz +# taken from the archive created from `make dist` command +# https://asamalik.fedorapeople.org/tmp-docs-preview/packaging-guidelines/SourceURL/ +# Source0: %{pypi_name}-%{version}.tar.gz +Source0: %{URL}/releases/latest/download/fcust-%{version}.tar.gz BuildArch: noarch @@ -26,7 +29,7 @@ BuildRequires: python3dist(cffi) and makes sure they have appropriate permissions. %prep -%autosetup -n %{pypi_name}-%{version} +%autosetup -p1 -n %{pypi_name}-%{version} # Remove bundled egg-info rm -rf %{pypi_name}.egg-info @@ -34,31 +37,39 @@ rm -rf %{pypi_name}.egg-info pip install --user --upgrade pip %py3_build # generate html and man docs -PYTHONPATH=${PWD} sphinx-build-3 docs html -PYTHONPATH=${PWD} sphinx-build-3 docs man -# remove the sphinx-build leftovers -rm -rf html/.{doctrees,buildinfo} +#sphinx-build-3 -b html docs/html docs/_build/html +sphinx-build-3 -b man docs docs/_build/man +sphinx-build-3 -b html docs docs/_build/html +rm -rf docs/_build/html/{.doctrees,.buildinfo} %install %py3_install -# %check -# getent group family 2>&1 > /dev/null || (sudo groupadd family && sudo usermod -a -G family $(whoami)) -# %{__python3} setup.py test +# Adapted from https://src.fedoraproject.org/rpms/python-pip/blob/a1e1c1dfc94168da1d9130179a86297c64a9488f/f/python-pip.spec#_302-310 +pushd docs/_build/man +install -d %{buildroot}%{_mandir}/man1 +for MAN in *1; do +install -pm0644 $MAN %{buildroot}%{_mandir}/man1/$MAN +done +popd %files -n %{pypi_name} %license LICENSE -%doc html -%{_mandir}/man1/fcust.1.gz +%doc docs/_build/html +%{_mandir}/man1/fcust.* %{_bindir}/fcust %{python3_sitelib}/%{pypi_name} %{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info %changelog + +* Wed Dec 28 2022 Nikolaos Perrakis - 1.0.1-1 +- Updated package to use pyproject.toml. +- Upgrade package for Fedora 37 + * Mon Dec 05 2022 Nikolaos Perrakis - 1.0.0-2 - Upgrade specfile -- Upgrade package for Fedora 37 * Sun Nov 21 2021 Nikolaos Perrakis - 1.0.0-1 - Updated package for Fedora 35. diff --git a/fcust/__init__.py b/fcust/__init__.py index ba8e5a9..45a94b7 100644 --- a/fcust/__init__.py +++ b/fcust/__init__.py @@ -3,5 +3,5 @@ # fmt: off __author__ = """Nikolaos Perrakis""" __email__ = 'nikperrakis@gmail.com' -__version__ = "1.0.0" +__version__ = "1.0.1" # fmt: on diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ccc5a1c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,65 @@ +[build-system] +requires = ["pyproject-toml>=0.0.10"] +# build-backend = "pyproject_toml.build_system.build_backend" +# backend-path = ["."] + +[project] +name = "fcust" +description = "Linux Common Folder Custodian" +version = "1.0.1" +authors = [ + { name = "Nikolaos Perrakis", email = "nikperrakis@gmail.com" } +] +dependencies = [ + "Click >= 7.1", +] +readme = "README.rst" +license = { text = "GNU General Public License v3 (GPLv3)" } +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] +#packages = [ +# { include = "fcust" }, +#] + +[project.optional-dependencies] +dev = [ + "pip", + "bump2version>=1.0", + "wheel", + "Sphinx", + "twine", + "check-manifest", + "pytest", + "pytest-runner", + "mock", + "flake8", + "black", + "mypy", + "coverage", + "yamllint", + "doc8", + "pluggy", + "docutils==0.17" # Added package to avoid pkg_resources.ContextualVersionConflict docutils error +] + +[project.urls] +homepage = "https://github.com/Iolaum/fcust" + +# https://stackoverflow.com/a/73066937 +[project.scripts] +fcust = "fcust.cli:main" + +[tool.pyproject-toml] +packages = ["pyproject_toml", "pyproject_toml.build_system", "pyproject_toml.tool"] + +# https://setuptools.pypa.io/en/latest/userguide/package_discovery.html +[tool.setuptools] +packages = ["fcust"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 80b45ea..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -Click>=7.1 diff --git a/setup.cfg b/setup.cfg index f0e110a..5cfdbbc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.0.0 +current_version = 1.0.1 commit = False tag = False allow_dirty = True @@ -8,6 +8,10 @@ allow_dirty = True search = version="{current_version}" replace = version="{new_version}" +[bumpversion:file:pyproject.toml] +search = version = "{current_version}" +replace = version = "{new_version}" + [bumpversion:file:fcust/__init__.py] search = __version__ = "{current_version}" replace = __version__ = "{new_version}" diff --git a/setup.py b/setup.py index 46ddff8..ac42fe2 100644 --- a/setup.py +++ b/setup.py @@ -1,85 +1,4 @@ #!/usr/bin/env python -"""The setup script.""" - -from setuptools import setup, find_packages -from pathlib import PurePath - -# Needs pip>=20 -from pip._internal.network.session import PipSession -from pip._internal.req import parse_requirements - -with open("README.rst") as readme_file: - readme = readme_file.read() - -with open("HISTORY.rst") as history_file: - history = history_file.read() - -# adapted from: -# https://stackoverflow.com/a/57191701, https://stackoverflow.com/a/59969843 -# https://alexanderwaldin.github.io/packaging-python-project.html -requirements0 = parse_requirements( - str(PurePath.joinpath(PurePath(__file__).parent, "requirements.txt")), - session=PipSession(), -) -requirements = [str(requirement.requirement) for requirement in requirements0] -del requirements0 - -dev_requirements = [ - "pip", - "bump2version>=1.0", - "wheel", - "Sphinx", - "twine", - "check-manifest", - "pytest", - "pytest-runner", - "mock", - "flake8", - "black", - "mypy", - "coverage", - "yamllint", - "doc8", - "pluggy", - "docutils==0.17" # Added package to avoid pkg_resources.ContextualVersionConflict docutils error -] - -setup( - author="Nikolaos Perrakis", - author_email="nikperrakis@gmail.com", - python_requires=">=3.8", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: End Users/Desktop", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - ], - # Adding man pages to python package: https://stackoverflow.com/a/48381612/1904901 - data_files=[("/usr/share/man/man1/", ["docs/_build/man/fcust.1"])], - description="Linux Common Folder Custodian", - entry_points={ - "console_scripts": [ - "fcust=fcust.cli:main", - ], - }, - install_requires=requirements, - license="GNU General Public License v3", - long_description=readme + "\n\n" + history, - include_package_data=True, - keywords="fcust", - name="fcust", - packages=find_packages(include=["fcust", "fcust.*"]), - setup_requires=dev_requirements, - test_suite="tests", - tests_require=dev_requirements, - # hack from https://stackoverflow.com/a/41398850/1904901 to be able to install deps from pip - extras_require={"dev": dev_requirements}, - url="https://github.com/Iolaum/fcust", - version="1.0.0", - zip_safe=False, -) +from setuptools import setup +setup()