Skip to content

Commit

Permalink
Port all setup.py to setuptools
Browse files Browse the repository at this point in the history
All setup.py files are now using setuptools through a common file
ipasetup.py. The file is auto-generated and contain all common
settings.

Signed-off-by: Christian Heimes <[email protected]>
Reviewed-By: Petr Spacek <[email protected]>
Reviewed-By: Jan Cholasta <[email protected]>
Reviewed-By: Martin Basti <[email protected]>
  • Loading branch information
tiran authored and pvoborni committed Oct 20, 2016
1 parent 8f98fa1 commit 4cd83fb
Show file tree
Hide file tree
Showing 23 changed files with 383 additions and 453 deletions.
11 changes: 4 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ freeipa2-dev-doc
/freeipa.spec
!/Makefile
/dist/
/*/dist/
/RELEASE
/rpmbuild/
# Build
/ipasetup.py
*.egg-info

# Subdirectories
/daemons/ipa-otpd/ipa-otpd
Expand All @@ -64,16 +68,9 @@ freeipa2-dev-doc
/client/ipa-join
/client/ipa-rmkeytab

/ipatests/setup.py

/ipaclient/setup.py

/ipalib/setup.py
!/ipalib/Makefile

/ipapython/setup.py
/ipapython/version.py
!/ipapython/Makefile

/ipaplatform/__init__.py
/ipaplatform/setup.py
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

66 changes: 38 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include VERSION
SUBDIRS=asn1 daemons install ipapython ipalib
CLIENTDIRS=ipapython ipalib client asn1
CLIENTPYDIRS=ipaclient ipaplatform
PYPKGDIRS=$(CLIENTPYDIRS) ipalib ipapython ipaserver ipatests

PRJ_PREFIX=freeipa

Expand Down Expand Up @@ -74,6 +75,10 @@ all: bootstrap-autogen server tests
(cd $$subdir && $(MAKE) $@) || exit 1; \
done

# empty target to force executation
.PHONY=FORCE
FORCE:

client: client-autogen
@for subdir in $(CLIENTDIRS); do \
(cd $$subdir && $(MAKE) all) || exit 1; \
Expand Down Expand Up @@ -161,31 +166,40 @@ test:
release-update:
if [ ! -e RELEASE ]; then echo 0 > RELEASE; fi

version-update: release-update
ipapython/version.py: ipapython/version.py.in FORCE
sed -e s/__VERSION__/$(IPA_VERSION)/ $< > $@
sed -i -e "s:__NUM_VERSION__:$(IPA_NUM_VERSION):" $@
sed -i -e "s:__VENDOR_VERSION__:$(IPA_VENDOR_VERSION):" $@
sed -i -e "s:__API_VERSION__:$(IPA_API_VERSION_MAJOR).$(IPA_API_VERSION_MINOR):" $@
grep -Po '(?<=default: ).*' API.txt | sed -n -i -e "/__DEFAULT_PLUGINS__/!{p;b};r /dev/stdin" $@
touch -r $< $@

ipasetup.py: ipasetup.py.in FORCE
sed -e s/__VERSION__/$(IPA_VERSION)/ $< > $@

ipaplatform/__init__.py: ipaplatform/__init__.py.in FORCE
if [ "$(SUPPORTED_PLATFORM)" != "" ]; then \
sed -e s/__PLATFORM__/$(SUPPORTED_PLATFORM)/ \
$< > $@; \
rm -f ipaplatform/constants.py ipaplatform/paths.py ipaplatform/services.py ipaplatform/tasks.py ; \
fi

.PHONY: egg_info
egg_info: ipapython/version.py ipaplatform/__init__.py ipasetup.py
for directory in $(PYPKGDIRS); do \
pushd $${directory} ; \
$(PYTHON) setup.py egg_info $(EXTRA_SETUP); \
popd ; \
done

version-update: release-update ipapython/version.py ipaplatform/__init__.py ipasetup.py egg_info
sed -e s/__VERSION__/$(IPA_VERSION)/ -e s/__RELEASE__/$(IPA_RPM_RELEASE)/ \
freeipa.spec.in > freeipa.spec
sed -e s/__VERSION__/$(IPA_VERSION)/ version.m4.in \
> version.m4
sed -e s/__VERSION__/$(IPA_VERSION)/ ipapython/setup.py.in \
> ipapython/setup.py
sed -e s/__VERSION__/$(IPA_VERSION)/ ipaplatform/setup.py.in \
> ipaplatform/setup.py
sed -e s/__VERSION__/$(IPA_VERSION)/ ipalib/setup.py.in \
> ipalib/setup.py
sed -e s/__VERSION__/$(IPA_VERSION)/ ipapython/version.py.in \
> ipapython/version.py
sed -e s/__VERSION__/$(IPA_VERSION)/ ipatests/setup.py.in \
> ipatests/setup.py
sed -e s/__VERSION__/$(IPA_VERSION)/ ipaclient/setup.py.in \
> ipaclient/setup.py
sed -e s/__NUM_VERSION__/$(IPA_NUM_VERSION)/ install/ui/src/libs/loader.js.in \
> install/ui/src/libs/loader.js
sed -i -e "s:__API_VERSION__:$(IPA_API_VERSION_MAJOR).$(IPA_API_VERSION_MINOR):" install/ui/src/libs/loader.js
sed -i -e "s:__NUM_VERSION__:$(IPA_NUM_VERSION):" ipapython/version.py
sed -i -e "s:__VENDOR_VERSION__:$(IPA_VENDOR_VERSION):" ipapython/version.py
sed -i -e "s:__API_VERSION__:$(IPA_API_VERSION_MAJOR).$(IPA_API_VERSION_MINOR):" ipapython/version.py
grep -Po '(?<=default: ).*' API.txt | sed -n -i -e "/__DEFAULT_PLUGINS__/!{p;b};r /dev/stdin" ipapython/version.py
touch -r ipapython/version.py.in ipapython/version.py
sed -e s/__VERSION__/$(IPA_VERSION)/ daemons/ipa-version.h.in \
> daemons/ipa-version.h
sed -i -e "s:__NUM_VERSION__:$(IPA_NUM_VERSION):" daemons/ipa-version.h
Expand All @@ -194,27 +208,22 @@ version-update: release-update
sed -e s/__VERSION__/$(IPA_VERSION)/ client/version.m4.in \
> client/version.m4

if [ "$(SUPPORTED_PLATFORM)" != "" ]; then \
sed -e s/__PLATFORM__/$(SUPPORTED_PLATFORM)/ \
ipaplatform/__init__.py.in > ipaplatform/__init__.py; \
fi

if [ "$(SKIP_API_VERSION_CHECK)" != "yes" ]; then \
./makeapi --validate && \
./makeaci --validate; \
fi

server: version-update
$(PYTHON) setup.py build
cd ipaserver && $(PYTHON) setup.py build
cd ipaplatform && $(PYTHON) setup.py build

server-install: server
if [ "$(DESTDIR)" = "" ]; then \
$(PYTHON) setup.py install; \
(cd ipaplatform && $(PYTHON) setup.py install); \
(cd ipaserver && $(PYTHON) setup.py install) || exit 1; \
(cd ipaplatform && $(PYTHON) setup.py install) || exit 1; \
else \
$(PYTHON) setup.py install --root $(DESTDIR); \
(cd ipaplatform && $(PYTHON) setup.py install --root $(DESTDIR)); \
(cd ipaserver && $(PYTHON) setup.py install --root $(DESTDIR)) || exit 1; \
(cd ipaplatform && $(PYTHON) setup.py install --root $(DESTDIR)) || exit 1; \
fi

tests: version-update tests-man-autogen
Expand Down Expand Up @@ -296,6 +305,7 @@ clean: version-update
@for subdir in $(SUBDIRS); do \
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
rm -rf ipasetup.py ipasetup.py?
rm -f *~

distclean: version-update
Expand Down
5 changes: 5 additions & 0 deletions ipaclient/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[bdist_wheel]
universal = 1

[metadata]
license_file = ../COPYING
45 changes: 45 additions & 0 deletions ipaclient/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/python2
# Copyright (C) 2007 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

"""FreeIPA client library
FreeIPA is a server for identity, policy, and audit.
"""
import os
import sys

# include ../ for ipasetup.py
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from ipasetup import ipasetup # noqa: E402

ipasetup(
name="ipaclient",
doc=__doc__,
scripts=['../ipa'],
package_dir={'ipaclient': ''},
packages=[
"ipaclient",
"ipaclient.plugins",
"ipaclient.remote_plugins",
"ipaclient.remote_plugins.2_49",
"ipaclient.remote_plugins.2_114",
"ipaclient.remote_plugins.2_156",
"ipaclient.remote_plugins.2_164",
],
)
80 changes: 0 additions & 80 deletions ipaclient/setup.py.in

This file was deleted.

3 changes: 1 addition & 2 deletions ipalib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ install:
fi

clean:
rm -f *~ *.pyc __pycache__/
rm -rf *~ *.pyc __pycache__/

distclean: clean
rm -f setup.py

maintainer-clean: distclean
rm -rf build
5 changes: 5 additions & 0 deletions ipalib/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[bdist_wheel]
universal = 1

[metadata]
license_file = ../COPYING
38 changes: 38 additions & 0 deletions ipalib/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/python2
# Copyright (C) 2007 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

"""FreeIPA common python library
FreeIPA is a server for identity, policy, and audit.
"""
import os
import sys

# include ../ for ipasetup.py
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from ipasetup import ipasetup # noqa: E402

ipasetup(
name="ipalib",
doc=__doc__,
package_dir={'ipalib': ''},
packages=[
"ipalib",
],
)
Loading

0 comments on commit 4cd83fb

Please sign in to comment.