URL: https://github.com/freeipa/freeipa/pull/472 Author: tiran Title: #472: Packaging: Add placeholder packages Action: synchronized
To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/472/head:pr472 git checkout pr472
From 41acd1dc09f5ed5c03620f51e8e7a502c548ee47 Mon Sep 17 00:00:00 2001 From: Christian Heimes <chei...@redhat.com> Date: Thu, 16 Feb 2017 15:27:49 +0100 Subject: [PATCH 1/7] Packaging: Add placeholder packages The ipa and freeipa packages are placeholders to prevent PyPI squashing attacks and reserve the names for future use. `pip install ipa` installs ipaclient. Signed-off-by: Christian Heimes <chei...@redhat.com> --- Makefile.am | 6 +++--- Makefile.python.am | 21 +++++++++++++-------- configure.ac | 3 +++ packaging/Makefile.am | 10 ++++++++++ packaging/freeipa/Makefile.am | 3 +++ packaging/freeipa/README.txt | 2 ++ packaging/freeipa/setup.cfg | 6 ++++++ packaging/freeipa/setup.py | 23 +++++++++++++++++++++++ packaging/ipa/Makefile.am | 3 +++ packaging/ipa/README.txt | 2 ++ packaging/ipa/setup.cfg | 6 ++++++ packaging/ipa/setup.py | 23 +++++++++++++++++++++++ 12 files changed, 97 insertions(+), 11 deletions(-) create mode 100644 packaging/Makefile.am create mode 100644 packaging/freeipa/Makefile.am create mode 100644 packaging/freeipa/README.txt create mode 100644 packaging/freeipa/setup.cfg create mode 100755 packaging/freeipa/setup.py create mode 100644 packaging/ipa/Makefile.am create mode 100644 packaging/ipa/README.txt create mode 100644 packaging/ipa/setup.cfg create mode 100755 packaging/ipa/setup.py diff --git a/Makefile.am b/Makefile.am index a35d18f..9595c9d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,11 +9,9 @@ if WITH_IPATESTS endif IPACLIENT_SUBDIRS = ipaclient ipalib ipapython - -SUBDIRS = asn1 util client contrib po \ +SUBDIRS = asn1 util client contrib po pypi \ $(IPACLIENT_SUBDIRS) ipaplatform $(IPATESTS_SUBDIRS) $(SERVER_SUBDIRS) - MOSTLYCLEANFILES = ipasetup.pyc ipasetup.pyo \ ignore_import_errors.pyc ignore_import_errors.pyo \ ipasetup.pyc ipasetup.pyo \ @@ -217,6 +215,8 @@ $(WHEELBUNDLEDIR): mkdir -p $(WHEELBUNDLEDIR) bdist_wheel: $(WHEELDISTDIR) + $(MAKE) $(AM_MAKEFLAGS) -C packaging/ipa bdist_wheel || exit 1; + $(MAKE) $(AM_MAKEFLAGS) -C packaging/freeipa bdist_wheel || exit 1; for dir in $(IPACLIENT_SUBDIRS); do \ $(MAKE) $(AM_MAKEFLAGS) -C $${dir} $@ || exit 1; \ done diff --git a/Makefile.python.am b/Makefile.python.am index 665893f..9c34fe3 100644 --- a/Makefile.python.am +++ b/Makefile.python.am @@ -1,5 +1,6 @@ pkgname = $(shell basename "$(abs_srcdir)") pkgpythondir = $(pythondir)/$(pkgname) +pkginstall = true if VERBOSE_MAKE VERBOSITY="--verbose" @@ -19,16 +20,20 @@ all-local: $(top_builddir)/ipasetup.py --build-base "$(abs_builddir)/build" install-exec-local: $(top_builddir)/ipasetup.py - $(PYTHON) $(srcdir)/setup.py \ - $(VERBOSITY) \ - install \ - --prefix "$(DESTDIR)$(prefix)" \ - --single-version-externally-managed \ - --record "$(DESTDIR)$(pkgpythondir)/install_files.txt" \ - --optimize 1 + if [ "x$(pkginstall)" = "xtrue" ]; then \ + $(PYTHON) $(srcdir)/setup.py \ + $(VERBOSITY) \ + install \ + --prefix "$(DESTDIR)$(prefix)" \ + --single-version-externally-managed \ + --record "$(DESTDIR)$(pkgpythondir)/install_files.txt" \ + --optimize 1; \ + fi uninstall-local: - cat "$(DESTDIR)$(pkgpythondir)/install_files.txt" | xargs rm -rf + if [ -f "$(DESTDIR)$(pkgpythondir)/install_files.txt" ]; then \ + cat "$(DESTDIR)$(pkgpythondir)/install_files.txt" | xargs rm -rf ; \ + fi rm -rf "$(DESTDIR)$(pkgpythondir)" clean-local: $(top_builddir)/ipasetup.py diff --git a/configure.ac b/configure.ac index 9ee281a..ebdd358 100644 --- a/configure.ac +++ b/configure.ac @@ -484,6 +484,9 @@ AC_CONFIG_FILES([ ipaserver/Makefile ipatests/Makefile ipatests/man/Makefile + packaging/Makefile + packaging/freeipa/Makefile + packaging/ipa/Makefile po/Makefile.in po/Makefile.hack util/Makefile diff --git a/packaging/Makefile.am b/packaging/Makefile.am new file mode 100644 index 0000000..5725ed9 --- /dev/null +++ b/packaging/Makefile.am @@ -0,0 +1,10 @@ +# This file will be processed with automake-1.7 to create Makefile.in +# +AUTOMAKE_OPTIONS = 1.7 subdir-objects + +NULL = + +SUBDIRS = \ + freeipa \ + ipa \ + $(NULL) diff --git a/packaging/freeipa/Makefile.am b/packaging/freeipa/Makefile.am new file mode 100644 index 0000000..15d86ce --- /dev/null +++ b/packaging/freeipa/Makefile.am @@ -0,0 +1,3 @@ +include $(top_srcdir)/Makefile.python.am + +pkginstall = false diff --git a/packaging/freeipa/README.txt b/packaging/freeipa/README.txt new file mode 100644 index 0000000..b58448f --- /dev/null +++ b/packaging/freeipa/README.txt @@ -0,0 +1,2 @@ +This is a dummy package for FreeIPA's ipaclient. + diff --git a/packaging/freeipa/setup.cfg b/packaging/freeipa/setup.cfg new file mode 100644 index 0000000..62f65c7 --- /dev/null +++ b/packaging/freeipa/setup.cfg @@ -0,0 +1,6 @@ +[bdist_wheel] +universal = 1 + +[aliases] +packages = clean --all egg_info bdist_wheel +release = packages register upload diff --git a/packaging/freeipa/setup.py b/packaging/freeipa/setup.py new file mode 100755 index 0000000..230fffd --- /dev/null +++ b/packaging/freeipa/setup.py @@ -0,0 +1,23 @@ +# +# Copyright (C) 2017 FreeIPA Contributors see COPYING for license +# +"""Dummy package for FreeIPA + +Please install ipaclient instead. +""" + +from os.path import abspath, dirname +import sys + +if __name__ == '__main__': + # include ../../ for ipasetup.py + sys.path.append(dirname(dirname(dirname(abspath(__file__))))) + from ipasetup import ipasetup # noqa: E402 + + ipasetup( + name='freeipa', + doc = __doc__, + install_requires=[ + "ipaclient", + ] + ) diff --git a/packaging/ipa/Makefile.am b/packaging/ipa/Makefile.am new file mode 100644 index 0000000..15d86ce --- /dev/null +++ b/packaging/ipa/Makefile.am @@ -0,0 +1,3 @@ +include $(top_srcdir)/Makefile.python.am + +pkginstall = false diff --git a/packaging/ipa/README.txt b/packaging/ipa/README.txt new file mode 100644 index 0000000..b58448f --- /dev/null +++ b/packaging/ipa/README.txt @@ -0,0 +1,2 @@ +This is a dummy package for FreeIPA's ipaclient. + diff --git a/packaging/ipa/setup.cfg b/packaging/ipa/setup.cfg new file mode 100644 index 0000000..62f65c7 --- /dev/null +++ b/packaging/ipa/setup.cfg @@ -0,0 +1,6 @@ +[bdist_wheel] +universal = 1 + +[aliases] +packages = clean --all egg_info bdist_wheel +release = packages register upload diff --git a/packaging/ipa/setup.py b/packaging/ipa/setup.py new file mode 100755 index 0000000..403389b --- /dev/null +++ b/packaging/ipa/setup.py @@ -0,0 +1,23 @@ +# +# Copyright (C) 2017 FreeIPA Contributors see COPYING for license +# +"""Dummy package for FreeIPA + +Please install ipaclient instead. +""" + +from os.path import abspath, dirname +import sys + +if __name__ == '__main__': + # include ../../ for ipasetup.py + sys.path.append(dirname(dirname(dirname(abspath(__file__))))) + from ipasetup import ipasetup # noqa: E402 + + ipasetup( + name='ipa', + doc = __doc__, + install_requires=[ + "ipaclient", + ] + ) From eabac6820d311b7d3c28683fd65f7c4f2d466976 Mon Sep 17 00:00:00 2001 From: Christian Heimes <chei...@redhat.com> Date: Fri, 17 Feb 2017 17:46:20 +0100 Subject: [PATCH 2/7] Add python-wheel as build requirement Signed-off-by: Christian Heimes <chei...@redhat.com> --- freeipa.spec.in | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/freeipa.spec.in b/freeipa.spec.in index 5c835ca..acc197e 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -124,6 +124,16 @@ BuildRequires: python-libsss_nss_idmap BuildRequires: python-cffi # +# Build dependencies for wheel packaging +# +%if 0%{?fedora} +BuildRequires: python2-wheel +%if 0%{?with_python3} +BuildRequires: python3-wheel +%endif +%endif # Fedora + +# # Build dependencies for lint # %if 0%{?with_lint} From e269b89168106c1d78a4643a639503e2cf1f2089 Mon Sep 17 00:00:00 2001 From: Christian Heimes <chei...@redhat.com> Date: Fri, 17 Feb 2017 17:46:42 +0100 Subject: [PATCH 3/7] Add placeholders for ipaplatform, ipaserver and ipatests I also renamed the base directory to pypi and added a new build target pypi_packages. Signed-off-by: Christian Heimes <chei...@redhat.com> --- Makefile.am | 14 +++++++++++--- Makefile.python.am | 2 +- configure.ac | 9 ++++++--- packaging/Makefile.am | 10 ---------- packaging/freeipa/Makefile.am | 3 --- packaging/freeipa/README.txt | 2 -- packaging/freeipa/setup.cfg | 6 ------ packaging/freeipa/setup.py | 23 ----------------------- packaging/ipa/Makefile.am | 3 --- packaging/ipa/README.txt | 2 -- packaging/ipa/setup.cfg | 6 ------ packaging/ipa/setup.py | 23 ----------------------- pypi/Makefile.am | 13 +++++++++++++ pypi/freeipa/Makefile.am | 3 +++ pypi/freeipa/README.txt | 2 ++ pypi/freeipa/setup.cfg | 6 ++++++ pypi/freeipa/setup.py | 23 +++++++++++++++++++++++ pypi/ipa/Makefile.am | 3 +++ pypi/ipa/README.txt | 2 ++ pypi/ipa/setup.cfg | 6 ++++++ pypi/ipa/setup.py | 23 +++++++++++++++++++++++ pypi/ipaplatform/Makefile.am | 3 +++ pypi/ipaplatform/README.txt | 2 ++ pypi/ipaplatform/ipaplatform/__init__.py | 5 +++++ pypi/ipaplatform/setup.cfg | 6 ++++++ pypi/ipaplatform/setup.py | 26 ++++++++++++++++++++++++++ pypi/ipaserver/Makefile.am | 3 +++ pypi/ipaserver/README.txt | 2 ++ pypi/ipaserver/ipaserver/__init__.py | 5 +++++ pypi/ipaserver/setup.cfg | 6 ++++++ pypi/ipaserver/setup.py | 26 ++++++++++++++++++++++++++ pypi/ipatests/Makefile.am | 3 +++ pypi/ipatests/README.txt | 2 ++ pypi/ipatests/ipatests/__init__.py | 5 +++++ pypi/ipatests/setup.cfg | 6 ++++++ pypi/ipatests/setup.py | 26 ++++++++++++++++++++++++++ 36 files changed, 225 insertions(+), 85 deletions(-) delete mode 100644 packaging/Makefile.am delete mode 100644 packaging/freeipa/Makefile.am delete mode 100644 packaging/freeipa/README.txt delete mode 100644 packaging/freeipa/setup.cfg delete mode 100755 packaging/freeipa/setup.py delete mode 100644 packaging/ipa/Makefile.am delete mode 100644 packaging/ipa/README.txt delete mode 100644 packaging/ipa/setup.cfg delete mode 100755 packaging/ipa/setup.py create mode 100644 pypi/Makefile.am create mode 100644 pypi/freeipa/Makefile.am create mode 100644 pypi/freeipa/README.txt create mode 100644 pypi/freeipa/setup.cfg create mode 100755 pypi/freeipa/setup.py create mode 100644 pypi/ipa/Makefile.am create mode 100644 pypi/ipa/README.txt create mode 100644 pypi/ipa/setup.cfg create mode 100755 pypi/ipa/setup.py create mode 100644 pypi/ipaplatform/Makefile.am create mode 100644 pypi/ipaplatform/README.txt create mode 100644 pypi/ipaplatform/ipaplatform/__init__.py create mode 100644 pypi/ipaplatform/setup.cfg create mode 100755 pypi/ipaplatform/setup.py create mode 100644 pypi/ipaserver/Makefile.am create mode 100644 pypi/ipaserver/README.txt create mode 100644 pypi/ipaserver/ipaserver/__init__.py create mode 100644 pypi/ipaserver/setup.cfg create mode 100755 pypi/ipaserver/setup.py create mode 100644 pypi/ipatests/Makefile.am create mode 100644 pypi/ipatests/README.txt create mode 100644 pypi/ipatests/ipatests/__init__.py create mode 100644 pypi/ipatests/setup.cfg create mode 100755 pypi/ipatests/setup.py diff --git a/Makefile.am b/Makefile.am index 9595c9d..26ba379 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,6 +9,7 @@ if WITH_IPATESTS endif IPACLIENT_SUBDIRS = ipaclient ipalib ipapython +IPA_PLACEHOLDERS = freeipa ipa ipaplatform ipaserver ipatests SUBDIRS = asn1 util client contrib po pypi \ $(IPACLIENT_SUBDIRS) ipaplatform $(IPATESTS_SUBDIRS) $(SERVER_SUBDIRS) @@ -204,7 +205,7 @@ jslint-html: cd $(top_srcdir)/install/html; \ jsl -nologo -nosummary -nofilelisting -conf jsl.conf -.PHONY: bdist_wheel wheel_bundle +.PHONY: bdist_wheel wheel_bundle wheel_placeholder pypi_packages WHEELDISTDIR = $(top_builddir)/dist/wheels WHEELBUNDLEDIR = $(top_builddir)/dist/bundle @@ -215,8 +216,6 @@ $(WHEELBUNDLEDIR): mkdir -p $(WHEELBUNDLEDIR) bdist_wheel: $(WHEELDISTDIR) - $(MAKE) $(AM_MAKEFLAGS) -C packaging/ipa bdist_wheel || exit 1; - $(MAKE) $(AM_MAKEFLAGS) -C packaging/freeipa bdist_wheel || exit 1; for dir in $(IPACLIENT_SUBDIRS); do \ $(MAKE) $(AM_MAKEFLAGS) -C $${dir} $@ || exit 1; \ done @@ -224,6 +223,15 @@ bdist_wheel: $(WHEELDISTDIR) wheel_bundle: $(WHEELBUNDLEDIR) bdist_wheel $(PYTHON) -m pip wheel --wheel-dir $(WHEELBUNDLEDIR) $(WHEELDISTDIR)/*.whl +wheel_placeholder: $(WHEELDISTDIR) + for dir in $(IPA_PLACEHOLDERS); do \ + $(MAKE) $(AM_MAKEFLAGS) -C $(top_srcdir)/pypi/$${dir} bdist_wheel || exit 1; \ + done + +pypi_packages: bdist_wheel wheel_placeholder + @echo -e "\n\nTo upload packages to PyPI, run:\n" + @echo -e " twine upload $(WHEELDISTDIR)/*-$(VERSION)-py2.py3-none-any.whl\n" + .PHONY: strip-po: $(MAKE) -C po strip-po diff --git a/Makefile.python.am b/Makefile.python.am index 9c34fe3..e4efc17 100644 --- a/Makefile.python.am +++ b/Makefile.python.am @@ -58,5 +58,5 @@ dist-hook: $(top_builddir)/ipasetup.py WHEELDISTDIR = $(top_builddir)/dist/wheels .PHONY: bdist_wheel bdist_wheel: $(top_builddir)/ipasetup.py - rm -rf $(WHEELDISTDIR)/$(pkgname)*.whl + rm -rf $(WHEELDISTDIR)/$(pkgname)-*.whl $(PYTHON) "$(srcdir)/setup.py" bdist_wheel --dist-dir=$(WHEELDISTDIR) diff --git a/configure.ac b/configure.ac index ebdd358..3f726bc 100644 --- a/configure.ac +++ b/configure.ac @@ -484,9 +484,12 @@ AC_CONFIG_FILES([ ipaserver/Makefile ipatests/Makefile ipatests/man/Makefile - packaging/Makefile - packaging/freeipa/Makefile - packaging/ipa/Makefile + pypi/Makefile + pypi/freeipa/Makefile + pypi/ipa/Makefile + pypi/ipaplatform/Makefile + pypi/ipaserver/Makefile + pypi/ipatests/Makefile po/Makefile.in po/Makefile.hack util/Makefile diff --git a/packaging/Makefile.am b/packaging/Makefile.am deleted file mode 100644 index 5725ed9..0000000 --- a/packaging/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -# This file will be processed with automake-1.7 to create Makefile.in -# -AUTOMAKE_OPTIONS = 1.7 subdir-objects - -NULL = - -SUBDIRS = \ - freeipa \ - ipa \ - $(NULL) diff --git a/packaging/freeipa/Makefile.am b/packaging/freeipa/Makefile.am deleted file mode 100644 index 15d86ce..0000000 --- a/packaging/freeipa/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -include $(top_srcdir)/Makefile.python.am - -pkginstall = false diff --git a/packaging/freeipa/README.txt b/packaging/freeipa/README.txt deleted file mode 100644 index b58448f..0000000 --- a/packaging/freeipa/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -This is a dummy package for FreeIPA's ipaclient. - diff --git a/packaging/freeipa/setup.cfg b/packaging/freeipa/setup.cfg deleted file mode 100644 index 62f65c7..0000000 --- a/packaging/freeipa/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[bdist_wheel] -universal = 1 - -[aliases] -packages = clean --all egg_info bdist_wheel -release = packages register upload diff --git a/packaging/freeipa/setup.py b/packaging/freeipa/setup.py deleted file mode 100755 index 230fffd..0000000 --- a/packaging/freeipa/setup.py +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (C) 2017 FreeIPA Contributors see COPYING for license -# -"""Dummy package for FreeIPA - -Please install ipaclient instead. -""" - -from os.path import abspath, dirname -import sys - -if __name__ == '__main__': - # include ../../ for ipasetup.py - sys.path.append(dirname(dirname(dirname(abspath(__file__))))) - from ipasetup import ipasetup # noqa: E402 - - ipasetup( - name='freeipa', - doc = __doc__, - install_requires=[ - "ipaclient", - ] - ) diff --git a/packaging/ipa/Makefile.am b/packaging/ipa/Makefile.am deleted file mode 100644 index 15d86ce..0000000 --- a/packaging/ipa/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -include $(top_srcdir)/Makefile.python.am - -pkginstall = false diff --git a/packaging/ipa/README.txt b/packaging/ipa/README.txt deleted file mode 100644 index b58448f..0000000 --- a/packaging/ipa/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -This is a dummy package for FreeIPA's ipaclient. - diff --git a/packaging/ipa/setup.cfg b/packaging/ipa/setup.cfg deleted file mode 100644 index 62f65c7..0000000 --- a/packaging/ipa/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[bdist_wheel] -universal = 1 - -[aliases] -packages = clean --all egg_info bdist_wheel -release = packages register upload diff --git a/packaging/ipa/setup.py b/packaging/ipa/setup.py deleted file mode 100755 index 403389b..0000000 --- a/packaging/ipa/setup.py +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright (C) 2017 FreeIPA Contributors see COPYING for license -# -"""Dummy package for FreeIPA - -Please install ipaclient instead. -""" - -from os.path import abspath, dirname -import sys - -if __name__ == '__main__': - # include ../../ for ipasetup.py - sys.path.append(dirname(dirname(dirname(abspath(__file__))))) - from ipasetup import ipasetup # noqa: E402 - - ipasetup( - name='ipa', - doc = __doc__, - install_requires=[ - "ipaclient", - ] - ) diff --git a/pypi/Makefile.am b/pypi/Makefile.am new file mode 100644 index 0000000..5d8be9c --- /dev/null +++ b/pypi/Makefile.am @@ -0,0 +1,13 @@ +# This file will be processed with automake-1.7 to create Makefile.in +# +AUTOMAKE_OPTIONS = 1.7 subdir-objects + +NULL = + +SUBDIRS = \ + freeipa \ + ipa \ + ipaplatform \ + ipaserver \ + ipatests \ + $(NULL) diff --git a/pypi/freeipa/Makefile.am b/pypi/freeipa/Makefile.am new file mode 100644 index 0000000..15d86ce --- /dev/null +++ b/pypi/freeipa/Makefile.am @@ -0,0 +1,3 @@ +include $(top_srcdir)/Makefile.python.am + +pkginstall = false diff --git a/pypi/freeipa/README.txt b/pypi/freeipa/README.txt new file mode 100644 index 0000000..b58448f --- /dev/null +++ b/pypi/freeipa/README.txt @@ -0,0 +1,2 @@ +This is a dummy package for FreeIPA's ipaclient. + diff --git a/pypi/freeipa/setup.cfg b/pypi/freeipa/setup.cfg new file mode 100644 index 0000000..62f65c7 --- /dev/null +++ b/pypi/freeipa/setup.cfg @@ -0,0 +1,6 @@ +[bdist_wheel] +universal = 1 + +[aliases] +packages = clean --all egg_info bdist_wheel +release = packages register upload diff --git a/pypi/freeipa/setup.py b/pypi/freeipa/setup.py new file mode 100755 index 0000000..230fffd --- /dev/null +++ b/pypi/freeipa/setup.py @@ -0,0 +1,23 @@ +# +# Copyright (C) 2017 FreeIPA Contributors see COPYING for license +# +"""Dummy package for FreeIPA + +Please install ipaclient instead. +""" + +from os.path import abspath, dirname +import sys + +if __name__ == '__main__': + # include ../../ for ipasetup.py + sys.path.append(dirname(dirname(dirname(abspath(__file__))))) + from ipasetup import ipasetup # noqa: E402 + + ipasetup( + name='freeipa', + doc = __doc__, + install_requires=[ + "ipaclient", + ] + ) diff --git a/pypi/ipa/Makefile.am b/pypi/ipa/Makefile.am new file mode 100644 index 0000000..15d86ce --- /dev/null +++ b/pypi/ipa/Makefile.am @@ -0,0 +1,3 @@ +include $(top_srcdir)/Makefile.python.am + +pkginstall = false diff --git a/pypi/ipa/README.txt b/pypi/ipa/README.txt new file mode 100644 index 0000000..b58448f --- /dev/null +++ b/pypi/ipa/README.txt @@ -0,0 +1,2 @@ +This is a dummy package for FreeIPA's ipaclient. + diff --git a/pypi/ipa/setup.cfg b/pypi/ipa/setup.cfg new file mode 100644 index 0000000..62f65c7 --- /dev/null +++ b/pypi/ipa/setup.cfg @@ -0,0 +1,6 @@ +[bdist_wheel] +universal = 1 + +[aliases] +packages = clean --all egg_info bdist_wheel +release = packages register upload diff --git a/pypi/ipa/setup.py b/pypi/ipa/setup.py new file mode 100755 index 0000000..403389b --- /dev/null +++ b/pypi/ipa/setup.py @@ -0,0 +1,23 @@ +# +# Copyright (C) 2017 FreeIPA Contributors see COPYING for license +# +"""Dummy package for FreeIPA + +Please install ipaclient instead. +""" + +from os.path import abspath, dirname +import sys + +if __name__ == '__main__': + # include ../../ for ipasetup.py + sys.path.append(dirname(dirname(dirname(abspath(__file__))))) + from ipasetup import ipasetup # noqa: E402 + + ipasetup( + name='ipa', + doc = __doc__, + install_requires=[ + "ipaclient", + ] + ) diff --git a/pypi/ipaplatform/Makefile.am b/pypi/ipaplatform/Makefile.am new file mode 100644 index 0000000..15d86ce --- /dev/null +++ b/pypi/ipaplatform/Makefile.am @@ -0,0 +1,3 @@ +include $(top_srcdir)/Makefile.python.am + +pkginstall = false diff --git a/pypi/ipaplatform/README.txt b/pypi/ipaplatform/README.txt new file mode 100644 index 0000000..15064b0 --- /dev/null +++ b/pypi/ipaplatform/README.txt @@ -0,0 +1,2 @@ +This is a dummy package for FreeIPA's ipaplatform. + diff --git a/pypi/ipaplatform/ipaplatform/__init__.py b/pypi/ipaplatform/ipaplatform/__init__.py new file mode 100644 index 0000000..3b12c8c --- /dev/null +++ b/pypi/ipaplatform/ipaplatform/__init__.py @@ -0,0 +1,5 @@ +# +# Copyright (C) 2017 FreeIPA Contributors see COPYING for license +# + +raise ImportError("ipaplatform is not yet supported as PyPI package.") diff --git a/pypi/ipaplatform/setup.cfg b/pypi/ipaplatform/setup.cfg new file mode 100644 index 0000000..62f65c7 --- /dev/null +++ b/pypi/ipaplatform/setup.cfg @@ -0,0 +1,6 @@ +[bdist_wheel] +universal = 1 + +[aliases] +packages = clean --all egg_info bdist_wheel +release = packages register upload diff --git a/pypi/ipaplatform/setup.py b/pypi/ipaplatform/setup.py new file mode 100755 index 0000000..f0fca2c --- /dev/null +++ b/pypi/ipaplatform/setup.py @@ -0,0 +1,26 @@ +# +# Copyright (C) 2017 FreeIPA Contributors see COPYING for license +# +"""Dummy package for FreeIPA + +ipaplatform is not yet available as PyPI package. +""" + +from os.path import abspath, dirname +import sys + +if __name__ == '__main__': + # include ../../ for ipasetup.py + sys.path.append(dirname(dirname(dirname(abspath(__file__))))) + from ipasetup import ipasetup # noqa: E402 + + ipasetup( + name='ipaplatform', + doc = __doc__, + packages=[ + "ipaplatform", + ], + install_requires=[ + "ipaclient", + ] + ) diff --git a/pypi/ipaserver/Makefile.am b/pypi/ipaserver/Makefile.am new file mode 100644 index 0000000..15d86ce --- /dev/null +++ b/pypi/ipaserver/Makefile.am @@ -0,0 +1,3 @@ +include $(top_srcdir)/Makefile.python.am + +pkginstall = false diff --git a/pypi/ipaserver/README.txt b/pypi/ipaserver/README.txt new file mode 100644 index 0000000..dea6ac4 --- /dev/null +++ b/pypi/ipaserver/README.txt @@ -0,0 +1,2 @@ +This is a dummy package for FreeIPA's ipaserver. + diff --git a/pypi/ipaserver/ipaserver/__init__.py b/pypi/ipaserver/ipaserver/__init__.py new file mode 100644 index 0000000..4cbf200 --- /dev/null +++ b/pypi/ipaserver/ipaserver/__init__.py @@ -0,0 +1,5 @@ +# +# Copyright (C) 2017 FreeIPA Contributors see COPYING for license +# + +raise ImportError("ipaserver is not yet supported as PyPI package.") diff --git a/pypi/ipaserver/setup.cfg b/pypi/ipaserver/setup.cfg new file mode 100644 index 0000000..62f65c7 --- /dev/null +++ b/pypi/ipaserver/setup.cfg @@ -0,0 +1,6 @@ +[bdist_wheel] +universal = 1 + +[aliases] +packages = clean --all egg_info bdist_wheel +release = packages register upload diff --git a/pypi/ipaserver/setup.py b/pypi/ipaserver/setup.py new file mode 100755 index 0000000..73e1e63 --- /dev/null +++ b/pypi/ipaserver/setup.py @@ -0,0 +1,26 @@ +# +# Copyright (C) 2017 FreeIPA Contributors see COPYING for license +# +"""Dummy package for FreeIPA + +ipatests is not yet available as PyPI package. +""" + +from os.path import abspath, dirname +import sys + +if __name__ == '__main__': + # include ../../ for ipasetup.py + sys.path.append(dirname(dirname(dirname(abspath(__file__))))) + from ipasetup import ipasetup # noqa: E402 + + ipasetup( + name='ipaserver', + doc = __doc__, + packages=[ + "ipaserver", + ], + install_requires=[ + "ipaclient", + ] + ) diff --git a/pypi/ipatests/Makefile.am b/pypi/ipatests/Makefile.am new file mode 100644 index 0000000..15d86ce --- /dev/null +++ b/pypi/ipatests/Makefile.am @@ -0,0 +1,3 @@ +include $(top_srcdir)/Makefile.python.am + +pkginstall = false diff --git a/pypi/ipatests/README.txt b/pypi/ipatests/README.txt new file mode 100644 index 0000000..3347eac --- /dev/null +++ b/pypi/ipatests/README.txt @@ -0,0 +1,2 @@ +This is a dummy package for FreeIPA's ipatests. + diff --git a/pypi/ipatests/ipatests/__init__.py b/pypi/ipatests/ipatests/__init__.py new file mode 100644 index 0000000..5592c53 --- /dev/null +++ b/pypi/ipatests/ipatests/__init__.py @@ -0,0 +1,5 @@ +# +# Copyright (C) 2017 FreeIPA Contributors see COPYING for license +# + +raise ImportError("ipatests is not yet supported as PyPI package.") diff --git a/pypi/ipatests/setup.cfg b/pypi/ipatests/setup.cfg new file mode 100644 index 0000000..62f65c7 --- /dev/null +++ b/pypi/ipatests/setup.cfg @@ -0,0 +1,6 @@ +[bdist_wheel] +universal = 1 + +[aliases] +packages = clean --all egg_info bdist_wheel +release = packages register upload diff --git a/pypi/ipatests/setup.py b/pypi/ipatests/setup.py new file mode 100755 index 0000000..808e510 --- /dev/null +++ b/pypi/ipatests/setup.py @@ -0,0 +1,26 @@ +# +# Copyright (C) 2017 FreeIPA Contributors see COPYING for license +# +"""Dummy package for FreeIPA + +ipatests is not yet available as PyPI package. +""" + +from os.path import abspath, dirname +import sys + +if __name__ == '__main__': + # include ../../ for ipasetup.py + sys.path.append(dirname(dirname(dirname(abspath(__file__))))) + from ipasetup import ipasetup # noqa: E402 + + ipasetup( + name='ipatests', + doc = __doc__, + packages=[ + "ipatests", + ], + install_requires=[ + "ipaclient", + ] + ) From 69a606bc0857df3adb3921ecc278dd80f27107bb Mon Sep 17 00:00:00 2001 From: Christian Heimes <chei...@redhat.com> Date: Wed, 22 Feb 2017 09:21:35 +0100 Subject: [PATCH 4/7] Add with_wheels global to install wheel and PyPI packaging dependencies Signed-off-by: Christian Heimes <chei...@redhat.com> --- freeipa.spec.in | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/freeipa.spec.in b/freeipa.spec.in index acc197e..d8602c9 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -17,6 +17,9 @@ %global without_jslint_option --without-jslint %endif +# Python wheel support and PyPI packages +%global with_wheels 0 + %global alt_name ipa %if 0%{?rhel} %global samba_version 4.0.5-1 @@ -124,14 +127,16 @@ BuildRequires: python-libsss_nss_idmap BuildRequires: python-cffi # -# Build dependencies for wheel packaging +# Build dependencies for wheel packaging and PyPI upload # -%if 0%{?fedora} +%if 0%{with_wheels} +BuildRequires: python2-twine BuildRequires: python2-wheel %if 0%{?with_python3} +BuildRequires: python3-twine BuildRequires: python3-wheel %endif -%endif # Fedora +%endif # with_wheels # # Build dependencies for lint From 6839d953313392073fdaba914864074c42730acf Mon Sep 17 00:00:00 2001 From: Christian Heimes <chei...@redhat.com> Date: Thu, 23 Feb 2017 14:12:22 +0100 Subject: [PATCH 5/7] Python build: use --build-base everywhere Some calls to setup.py specified a build base, some did not. This can lead to issues, e.g. build, clean and install are using different build directories. Signed-off-by: Christian Heimes <chei...@redhat.com> --- Makefile.python.am | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Makefile.python.am b/Makefile.python.am index e4efc17..4b9dc1d 100644 --- a/Makefile.python.am +++ b/Makefile.python.am @@ -17,17 +17,19 @@ all-local: $(top_builddir)/ipasetup.py cd $(srcdir); $(PYTHON) setup.py \ $(VERBOSITY) \ build \ - --build-base "$(abs_builddir)/build" + --build-base "$(abs_builddir)/build" install-exec-local: $(top_builddir)/ipasetup.py if [ "x$(pkginstall)" = "xtrue" ]; then \ $(PYTHON) $(srcdir)/setup.py \ $(VERBOSITY) \ + build \ + --build-base "$(abs_builddir)/build" \ install \ - --prefix "$(DESTDIR)$(prefix)" \ - --single-version-externally-managed \ - --record "$(DESTDIR)$(pkgpythondir)/install_files.txt" \ - --optimize 1; \ + --prefix "$(DESTDIR)$(prefix)" \ + --single-version-externally-managed \ + --record "$(DESTDIR)$(pkgpythondir)/install_files.txt" \ + --optimize 1; \ fi uninstall-local: @@ -37,7 +39,10 @@ uninstall-local: rm -rf "$(DESTDIR)$(pkgpythondir)" clean-local: $(top_builddir)/ipasetup.py - $(PYTHON) "$(srcdir)/setup.py" clean --all + $(PYTHON) "$(srcdir)/setup.py" \ + clean \ + --all + --build-base "$(abs_builddir)/build" rm -rf "$(srcdir)/build" "$(srcdir)/dist" "$(srcdir)/MANIFEST" find "$(srcdir)" \ -name "*.py[co]" -delete -o \ @@ -59,4 +64,8 @@ WHEELDISTDIR = $(top_builddir)/dist/wheels .PHONY: bdist_wheel bdist_wheel: $(top_builddir)/ipasetup.py rm -rf $(WHEELDISTDIR)/$(pkgname)-*.whl - $(PYTHON) "$(srcdir)/setup.py" bdist_wheel --dist-dir=$(WHEELDISTDIR) + $(PYTHON) "$(srcdir)/setup.py" \ + build \ + --build-base "$(abs_builddir)/build" \ + bdist_wheel \ + --dist-dir=$(WHEELDISTDIR) From 13870125e2cc66bcc02683cb854ed9c59cbcc561 Mon Sep 17 00:00:00 2001 From: Christian Heimes <chei...@redhat.com> Date: Thu, 23 Feb 2017 16:19:30 +0100 Subject: [PATCH 6/7] pylint: ignore pypi placeholders pylint gets confused by duplicated package names, e.g. ipaplatform and pypi/ipaplatform. Signed-off-by: Christian Heimes <chei...@redhat.com> --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 26ba379..a6ff627 100644 --- a/Makefile.am +++ b/Makefile.am @@ -171,6 +171,7 @@ pylint: $(top_builddir)/ipapython/version.py ipasetup.py -path './rpmbuild' -prune -o \ -path './freeipa-*' -prune -o \ -path './dist' -prune -o \ + -path './pypi' -prune -o \ -name '.*' -o \ -name '*.in' -o \ -name '*~' -o \ From b443513633e790d2c8177e07e89af35a4a961a53 Mon Sep 17 00:00:00 2001 From: Christian Heimes <chei...@redhat.com> Date: Thu, 23 Feb 2017 16:26:14 +0100 Subject: [PATCH 7/7] Default to pkginstall=true without duplicated definitions Signed-off-by: Christian Heimes <chei...@redhat.com> --- Makefile.python.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile.python.am b/Makefile.python.am index 4b9dc1d..f158ff5 100644 --- a/Makefile.python.am +++ b/Makefile.python.am @@ -1,6 +1,5 @@ pkgname = $(shell basename "$(abs_srcdir)") pkgpythondir = $(pythondir)/$(pkgname) -pkginstall = true if VERBOSE_MAKE VERBOSITY="--verbose" @@ -20,7 +19,7 @@ all-local: $(top_builddir)/ipasetup.py --build-base "$(abs_builddir)/build" install-exec-local: $(top_builddir)/ipasetup.py - if [ "x$(pkginstall)" = "xtrue" ]; then \ + if [ "x$(pkginstall)" != "xfalse" ]; then \ $(PYTHON) $(srcdir)/setup.py \ $(VERBOSITY) \ build \
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code