URL: https://github.com/freeipa/freeipa/pull/132
Author: tiran
 Title: #132: Draft for a new setup.py (WIP)
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/132/head:pr132
git checkout pr132
From 0e2692dc1b26d57f9bd6809c9c2c44282d8d5f28 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Tue, 4 Oct 2016 13:23:22 +0200
Subject: [PATCH] Draft for a new setup.py

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 .gitignore              |  10 +--
 MANIFEST.in             |   3 +-
 Makefile                |  25 +++---
 client/man/Makefile.am  |   3 +-
 client/man/ipa.1        | 204 ++++++++++++++++++++++++++++++++++++++++++++++++
 ipa.1                   | 204 ------------------------------------------------
 ipaclient/setup.py      |  38 +++++++++
 ipaclient/setup.py.in   |  81 -------------------
 ipalib/Makefile         |   2 +-
 ipalib/setup.py         |  32 ++++++++
 ipalib/setup.py.in      |  71 -----------------
 ipaplatform/setup.py    |  36 +++++++++
 ipaplatform/setup.py.in |  79 -------------------
 ipapython/Makefile      |   2 +-
 ipapython/setup.py      |  35 +++++++++
 ipapython/setup.py.in   |  79 -------------------
 ipasetup.py.in          |  71 +++++++++++++++++
 ipatests/setup.py       |  54 +++++++++++++
 ipatests/setup.py.in    |  97 -----------------------
 setup.py                |  51 +-----------
 20 files changed, 496 insertions(+), 681 deletions(-)
 create mode 100644 client/man/ipa.1
 delete mode 100644 ipa.1
 create mode 100644 ipaclient/setup.py
 delete mode 100644 ipaclient/setup.py.in
 create mode 100644 ipalib/setup.py
 delete mode 100644 ipalib/setup.py.in
 create mode 100644 ipaplatform/setup.py
 delete mode 100644 ipaplatform/setup.py.in
 create mode 100755 ipapython/setup.py
 delete mode 100755 ipapython/setup.py.in
 create mode 100644 ipasetup.py.in
 create mode 100644 ipatests/setup.py
 delete mode 100644 ipatests/setup.py.in

diff --git a/.gitignore b/.gitignore
index 61054de..0e63640 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,6 +41,9 @@ freeipa2-dev-doc
 /dist/
 /RELEASE
 /rpmbuild/
+# Build
+ipasetup.py
+*.egg-info
 
 # Subdirectories
 /daemons/ipa-otpd/ipa-otpd
@@ -64,19 +67,12 @@ 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
 /ipaplatform/tasks.py
 /ipaplatform/services.py
 /ipaplatform/paths.py
diff --git a/MANIFEST.in b/MANIFEST.in
index dd76e10..f34cc7e 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,2 +1 @@
-include COPYING TODO lite-server.py
-include tests/*/*.py
+include COPYING lite-server.py
diff --git a/Makefile b/Makefile
index 6324308..794226c 100644
--- a/Makefile
+++ b/Makefile
@@ -161,23 +161,25 @@ test:
 release-update:
 	if [ ! -e RELEASE ]; then echo 0 > RELEASE; fi
 
-version-update: release-update
+.PHONY: ipasetup
+ipasetup:
+	sed -e s/__VERSION__/$(IPA_VERSION)/ ipasetup.py.in \
+		> ipasetup.py
+	$(PYTHON) setup.py egg_info
+	for directory in ipaclient ipalib ipaplatform ipapython ipatests; do \
+	    pushd $${directory} ; \
+	    cp ../ipasetup.py . ; \
+	    $(PYTHON) setup.py egg_info ; \
+	    popd ; \
+	done
+
+version-update: release-update ipasetup
 	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
@@ -301,6 +303,7 @@ clean: version-update
 	@for subdir in $(SUBDIRS); do \
 		(cd $$subdir && $(MAKE) $@) || exit 1; \
 	done
+	find . -name 'ipasetup.py' -or -name 'ipasetup.py[co]' | xargs rm -f
 	rm -f *~
 
 distclean: version-update
diff --git a/client/man/Makefile.am b/client/man/Makefile.am
index 9d8a9c0..1f067ab 100644
--- a/client/man/Makefile.am
+++ b/client/man/Makefile.am
@@ -10,7 +10,8 @@ man1_MANS = 				\
 		ipa-client-install.1	\
 		ipa-client-automount.1	\
 		ipa-certupdate.1	\
-		ipa-join.1
+		ipa-join.1		\
+		ipa.1
 
 man5_MANS =				\
 		default.conf.5
diff --git a/client/man/ipa.1 b/client/man/ipa.1
new file mode 100644
index 0000000..9194ca0
--- /dev/null
+++ b/client/man/ipa.1
@@ -0,0 +1,204 @@
+.\" A man page for ipa
+.\" Copyright (C) 2010-2016 Red Hat, Inc.
+.\"
+.\" 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/>.
+.\"
+.\" Author: Pavel Zuna <pz...@redhat.com>
+.\"
+.TH "ipa" "1" "Apr 29 2016" "FreeIPA" "FreeIPA Manual Pages"
+.SH "NAME"
+ipa \- IPA command\-line interface
+.SH "SYNOPSIS"
+.nf
+\fBipa\fR [options] [\fB\-c\fR \fIFILE\fR] [\fB\-e\fR \fIKEY=VAL\fR] \fICOMMAND\fR [parameters]
+.fi
+.SH "DESCRIPTION"
+IPA is an integrated security information management solution based on 389 Directory Server (formerly know as Fedora Directory Server), MIT Kerberos, Dogtag Certificate System, NTP and DNS. It includes a web interface and command\-line administration tools for managing identity data.
+
+This manual page focuses on the \fIipa\fR script that serves as the main command\-line interface (CLI) for IPA administration.
+
+More information about the project is available on its homepage located at http://www.freeipa.org.
+.SH "OPTIONS"
+.TP
+\fB\-c\fR \fIFILE\fR
+Load configuration from \fIFILE\fR.
+.TP
+\fB\-d\fR, \fB\-\-debug\fR
+Produce full debugging output.
+.TP
+\fB\-\-delegate\fR
+Delegate the user's TGT to the IPA server
+.TP
+\fB\-e\fR \fIKEY=VAL\fR
+Set environmental variable \fIKEY\fR to the value \fIVAL\fR. This option overrides configuration files.
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Display a help message with a list of options.
+.TP
+\fB\-n\fR, \fB\-\-no\-prompt\fR
+Don't prompt for any parameters of \fBCOMMAND\fR, even if they are required.
+.TP
+\fB\-a\fR, \fB\-\-prompt\-all\fR
+Prompt for all parameters of \fICOMMAND\fR, even if they are optional.
+.TP
+\fB\-f\fR, \fB\-\-no\-fallback\fR
+Don't fall back to other IPA servers if the default doesn't work.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Produce verbose output. A second -v pretty-prints the JSON request and response. A third \-v displays the HTTP request and response.
+.TP
+\fB\-\-version\fR
+Display the IPA version and API version.
+.SH "COMMANDS"
+The principal function of the CLI is to execute administrative commands specified by the \fICOMMAND\fR argument. The majority of commands are executed remotely over XML\-RPC on a IPA server listed in the configuration file (see FILES section of this manual page).
+
+From the implementation perspective, the CLI distinguishes two types of commands \- built\-ins and plugin provided.
+
+Built\-in commands are static and are all available in all installations of IPA. There are two of them:
+.TP
+\fBconsole\fR
+Start the IPA interactive Python console.
+.TP
+\fBhelp\fR [\fITOPIC\fR | \fICOMMAND\fR | \fBtopics\fR | \fBcommands\fR]
+Display help for a command or topic.
+
+The \fBhelp\fR command invokes the built\-in documentation system. Without parameters a list of built\-in commands and help topics is displayed. Help topics are generated from loaded IPA plugin modules. Executing \fBhelp\fR with the name of an available topic displays a help message provided by the corresponding plugin module and list of commands it contains.
+.LP
+Plugin provided commands, as the name suggests, originate from IPA plugin modules. The available set may vary depending on your configuration and can be listed using the built\-in \fBhelp\fR command (see above).
+
+Most plugin provided commands are tied to a certain type of IPA object. IPA objects encompass common abstractions such as users (user identities/accounts), hosts (machine identities), services, password policies, etc. Commands associated with an object are easily identified thanks to the enforced naming convention; the command names are composed of two parts separated with a dash: the name of the corresponding IPA object type and the name of action performed on it. For example all commands used to manage user identities start with "user\-" (e.g. user\-add, user\-del).
+
+The following actions are available for most IPA object types:
+.TP
+\fBadd\fR [\fIPRIMARYKEY\fR] [options]
+Create a new object.
+.TP
+\fBshow\fR [\fIPRIMARYKEY\fR] [options]
+Display an existing object.
+.TP
+\fBmod\fR [\fIPRIMARYKEY\fR] [options]
+Modify an existing object.
+.TP
+\fBdel\fR [\fIPRIMARYKEY\fR]
+Delete an existing object.
+.TP
+\fBfind\fR [\fICRITERIA\fR] [options]
+Search for existing objects.
+.LP
+The above types of commands except \fBfind\fR take the objects primary key (e.g. user name for users) as their only positional argument unless there can be only one object of the given type. They can also take a number of options (some of which might be required in the case of \fBadd\fR) that represent the objects attributes.
+
+\fBfind\fR commands take an optional criteria string as their only positional argument. If present, all objects with an attribute that contains the criteria string are displayed. If an option representing an attribute is set, only object with the attribute exactly matching the specified value are displayed. Options with empty values are ignored. Without parameters all objects of the corresponding type are displayed.
+
+For IPA objects with attributes that can contain references to other objects (e.g. groups), the following action are usually available:
+.TP
+\fBadd\-member\fR [\fIPRIMARYKEY\fR] [options]
+Add references to other objects.
+.TP
+\fBremove\-member\fR [\fIPRIMARYKEY\fR] [options]
+Remove references to other objects.
+.LP
+The above types of commands take the objects primary key as their only positional argument unless there can be only one object of the given type. They also take a number of options that represent lists of other object primary keys. Each of these options represent one type of object.
+
+For some types of objects, these commands might need to take more than one primary key. This applies to IPA objects organized in hierarchies where the parent object needs to be identified first. Parent primary keys are always aligned to the left (higher in the hierarchy = more to the left). For example the automount IPA plugin enables users to manage automount maps per location, as a result all automount commands take an automountlocation primary key as their first positional argument.
+
+All commands that display objects have three special options for controlling output:
+.TP
+\fB\-\-all\fR
+Display all attributes. Without this option only the most relevant attributes are displayed.
+.TP
+\fB\-\-raw\fR
+Display objects as they are stored in the backing store. Disables formatting and attribute labels.
+.TP
+\fB\-\-rights\fR
+Display effective rights on all attributes of the entry. You also have to specify \fB\-\-all\fR for this to work. User rights are returned as Python dictionary where index is the name of an attribute and value is a unicode string composed (hence the u'xxxx' format) of letters specified below. Note that user rights are primarily used for internal purposes of CLI and WebUI.
+
+.ad l
+r \- read\p
+s \- search\p
+w \- write\p
+o \- obliterate (delete)\p
+c \- compare\p
+W \- self\-write\p
+O \- self\-obliterate
+
+.SH "EXAMPLES"
+.TP
+\fBipa help commands\fR
+Display a list of available commands
+\fBipa help topics\fR
+Display a high\-level list of help topics
+\fBipa help user\fR
+Display documentation and list of commands in the "user" topic.
+.TP
+\fBipa env\fR
+List IPA environmental variables and their values.
+.TP
+\fBipa user\-add foo \-\-first foo \-\-last bar\fR
+Create a new user with username "foo", first name "foo" and last name "bar".
+.TP
+\fBipa group\-add bar \-\-desc "this is an example group"
+Create a new group with name "bar" and description "this is an example group".
+.TP
+\fBipa group\-add\-member bar \-\-users=foo\fR
+Add user "foo" to the group "bar".
+.TP
+\fBipa group\-add\-member bar \-\-users={admin,foo}\fR
+Add users "admin" and "foo" to the group "bar". This approach depends on shell expansion feature.
+.TP
+\fBipa user\-show foo \-\-raw\fR
+Display user "foo" as (s)he is stored on the server.
+.TP
+\fBipa group\-show bar \-\-all\fR
+Display group "bar" and all of its attributes.
+.TP
+\fBipa config\-mod \-\-maxusername 20\fR
+Set maximum user name length to 20 characters.
+.TP
+\fBipa user\-find foo\fR
+Search for all users with "foo" in either uid, first name, last name, full name, etc. A user with uid "foobar" would match the search criteria.
+.TP
+\fBipa user\-find foo \-\-first bar\fR
+Same as the previous example, except this time the users first name has to be exactly "bar". A user with uid "foobar" and first name "bar" would match the search criteria.
+.TP
+\fBipa user\-find foo \-\-first bar \-\-last foo\fR
+A user with uid "foobar", first name "bar" and last name "foo" would match the search criteria.
+.TP
+\fBipa user\-find\fR
+All users would match the search criteria (as there are none).
+.SH "SERVERS"
+The ipa client will determine which server to connect to in this order:
+
+.TP
+1. The server configured in \fB/etc/ipa/default.conf\fR in the \fIxmlrpc_uri\fR directive.
+.TP
+2. An unordered list of servers from the ldap DNS SRV records.
+
+.TP
+If a kerberos error is raised by any of the requests then it will stop processing and display the error message.
+.SH "FILES"
+.TP
+\fB/etc/ipa/default.conf\fR
+IPA default configuration file.
+.SH "EXIT STATUS"
+0 if the command was successful
+
+1 if an error occurred
+
+2 If an entry is not found
+.SH "SEE ALSO"
+ipa\-client\-install(1), ipa\-compat\-manage(1), ipactl(1), ipa\-dns\-install(1),
+ipa\-getcert(1), ipa\-getkeytab(1), ipa\-join(1), ipa\-ldap\-updater(1),
+ipa\-nis\-manage(1), ipa\-replica\-install(1), ipa\-replica\-manage(1), ipa\-replica\-prepare(1),
+ipa\-rmkeytab(1), ipa\-server\-certinstall(2), ipa\-server\-install(1), ipa\-server\-upgrade(1)
+
diff --git a/ipa.1 b/ipa.1
deleted file mode 100644
index 9194ca0..0000000
--- a/ipa.1
+++ /dev/null
@@ -1,204 +0,0 @@
-.\" A man page for ipa
-.\" Copyright (C) 2010-2016 Red Hat, Inc.
-.\"
-.\" 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/>.
-.\"
-.\" Author: Pavel Zuna <pz...@redhat.com>
-.\"
-.TH "ipa" "1" "Apr 29 2016" "FreeIPA" "FreeIPA Manual Pages"
-.SH "NAME"
-ipa \- IPA command\-line interface
-.SH "SYNOPSIS"
-.nf
-\fBipa\fR [options] [\fB\-c\fR \fIFILE\fR] [\fB\-e\fR \fIKEY=VAL\fR] \fICOMMAND\fR [parameters]
-.fi
-.SH "DESCRIPTION"
-IPA is an integrated security information management solution based on 389 Directory Server (formerly know as Fedora Directory Server), MIT Kerberos, Dogtag Certificate System, NTP and DNS. It includes a web interface and command\-line administration tools for managing identity data.
-
-This manual page focuses on the \fIipa\fR script that serves as the main command\-line interface (CLI) for IPA administration.
-
-More information about the project is available on its homepage located at http://www.freeipa.org.
-.SH "OPTIONS"
-.TP
-\fB\-c\fR \fIFILE\fR
-Load configuration from \fIFILE\fR.
-.TP
-\fB\-d\fR, \fB\-\-debug\fR
-Produce full debugging output.
-.TP
-\fB\-\-delegate\fR
-Delegate the user's TGT to the IPA server
-.TP
-\fB\-e\fR \fIKEY=VAL\fR
-Set environmental variable \fIKEY\fR to the value \fIVAL\fR. This option overrides configuration files.
-.TP
-\fB\-h\fR, \fB\-\-help\fR
-Display a help message with a list of options.
-.TP
-\fB\-n\fR, \fB\-\-no\-prompt\fR
-Don't prompt for any parameters of \fBCOMMAND\fR, even if they are required.
-.TP
-\fB\-a\fR, \fB\-\-prompt\-all\fR
-Prompt for all parameters of \fICOMMAND\fR, even if they are optional.
-.TP
-\fB\-f\fR, \fB\-\-no\-fallback\fR
-Don't fall back to other IPA servers if the default doesn't work.
-.TP
-\fB\-v\fR, \fB\-\-verbose\fR
-Produce verbose output. A second -v pretty-prints the JSON request and response. A third \-v displays the HTTP request and response.
-.TP
-\fB\-\-version\fR
-Display the IPA version and API version.
-.SH "COMMANDS"
-The principal function of the CLI is to execute administrative commands specified by the \fICOMMAND\fR argument. The majority of commands are executed remotely over XML\-RPC on a IPA server listed in the configuration file (see FILES section of this manual page).
-
-From the implementation perspective, the CLI distinguishes two types of commands \- built\-ins and plugin provided.
-
-Built\-in commands are static and are all available in all installations of IPA. There are two of them:
-.TP
-\fBconsole\fR
-Start the IPA interactive Python console.
-.TP
-\fBhelp\fR [\fITOPIC\fR | \fICOMMAND\fR | \fBtopics\fR | \fBcommands\fR]
-Display help for a command or topic.
-
-The \fBhelp\fR command invokes the built\-in documentation system. Without parameters a list of built\-in commands and help topics is displayed. Help topics are generated from loaded IPA plugin modules. Executing \fBhelp\fR with the name of an available topic displays a help message provided by the corresponding plugin module and list of commands it contains.
-.LP
-Plugin provided commands, as the name suggests, originate from IPA plugin modules. The available set may vary depending on your configuration and can be listed using the built\-in \fBhelp\fR command (see above).
-
-Most plugin provided commands are tied to a certain type of IPA object. IPA objects encompass common abstractions such as users (user identities/accounts), hosts (machine identities), services, password policies, etc. Commands associated with an object are easily identified thanks to the enforced naming convention; the command names are composed of two parts separated with a dash: the name of the corresponding IPA object type and the name of action performed on it. For example all commands used to manage user identities start with "user\-" (e.g. user\-add, user\-del).
-
-The following actions are available for most IPA object types:
-.TP
-\fBadd\fR [\fIPRIMARYKEY\fR] [options]
-Create a new object.
-.TP
-\fBshow\fR [\fIPRIMARYKEY\fR] [options]
-Display an existing object.
-.TP
-\fBmod\fR [\fIPRIMARYKEY\fR] [options]
-Modify an existing object.
-.TP
-\fBdel\fR [\fIPRIMARYKEY\fR]
-Delete an existing object.
-.TP
-\fBfind\fR [\fICRITERIA\fR] [options]
-Search for existing objects.
-.LP
-The above types of commands except \fBfind\fR take the objects primary key (e.g. user name for users) as their only positional argument unless there can be only one object of the given type. They can also take a number of options (some of which might be required in the case of \fBadd\fR) that represent the objects attributes.
-
-\fBfind\fR commands take an optional criteria string as their only positional argument. If present, all objects with an attribute that contains the criteria string are displayed. If an option representing an attribute is set, only object with the attribute exactly matching the specified value are displayed. Options with empty values are ignored. Without parameters all objects of the corresponding type are displayed.
-
-For IPA objects with attributes that can contain references to other objects (e.g. groups), the following action are usually available:
-.TP
-\fBadd\-member\fR [\fIPRIMARYKEY\fR] [options]
-Add references to other objects.
-.TP
-\fBremove\-member\fR [\fIPRIMARYKEY\fR] [options]
-Remove references to other objects.
-.LP
-The above types of commands take the objects primary key as their only positional argument unless there can be only one object of the given type. They also take a number of options that represent lists of other object primary keys. Each of these options represent one type of object.
-
-For some types of objects, these commands might need to take more than one primary key. This applies to IPA objects organized in hierarchies where the parent object needs to be identified first. Parent primary keys are always aligned to the left (higher in the hierarchy = more to the left). For example the automount IPA plugin enables users to manage automount maps per location, as a result all automount commands take an automountlocation primary key as their first positional argument.
-
-All commands that display objects have three special options for controlling output:
-.TP
-\fB\-\-all\fR
-Display all attributes. Without this option only the most relevant attributes are displayed.
-.TP
-\fB\-\-raw\fR
-Display objects as they are stored in the backing store. Disables formatting and attribute labels.
-.TP
-\fB\-\-rights\fR
-Display effective rights on all attributes of the entry. You also have to specify \fB\-\-all\fR for this to work. User rights are returned as Python dictionary where index is the name of an attribute and value is a unicode string composed (hence the u'xxxx' format) of letters specified below. Note that user rights are primarily used for internal purposes of CLI and WebUI.
-
-.ad l
-r \- read\p
-s \- search\p
-w \- write\p
-o \- obliterate (delete)\p
-c \- compare\p
-W \- self\-write\p
-O \- self\-obliterate
-
-.SH "EXAMPLES"
-.TP
-\fBipa help commands\fR
-Display a list of available commands
-\fBipa help topics\fR
-Display a high\-level list of help topics
-\fBipa help user\fR
-Display documentation and list of commands in the "user" topic.
-.TP
-\fBipa env\fR
-List IPA environmental variables and their values.
-.TP
-\fBipa user\-add foo \-\-first foo \-\-last bar\fR
-Create a new user with username "foo", first name "foo" and last name "bar".
-.TP
-\fBipa group\-add bar \-\-desc "this is an example group"
-Create a new group with name "bar" and description "this is an example group".
-.TP
-\fBipa group\-add\-member bar \-\-users=foo\fR
-Add user "foo" to the group "bar".
-.TP
-\fBipa group\-add\-member bar \-\-users={admin,foo}\fR
-Add users "admin" and "foo" to the group "bar". This approach depends on shell expansion feature.
-.TP
-\fBipa user\-show foo \-\-raw\fR
-Display user "foo" as (s)he is stored on the server.
-.TP
-\fBipa group\-show bar \-\-all\fR
-Display group "bar" and all of its attributes.
-.TP
-\fBipa config\-mod \-\-maxusername 20\fR
-Set maximum user name length to 20 characters.
-.TP
-\fBipa user\-find foo\fR
-Search for all users with "foo" in either uid, first name, last name, full name, etc. A user with uid "foobar" would match the search criteria.
-.TP
-\fBipa user\-find foo \-\-first bar\fR
-Same as the previous example, except this time the users first name has to be exactly "bar". A user with uid "foobar" and first name "bar" would match the search criteria.
-.TP
-\fBipa user\-find foo \-\-first bar \-\-last foo\fR
-A user with uid "foobar", first name "bar" and last name "foo" would match the search criteria.
-.TP
-\fBipa user\-find\fR
-All users would match the search criteria (as there are none).
-.SH "SERVERS"
-The ipa client will determine which server to connect to in this order:
-
-.TP
-1. The server configured in \fB/etc/ipa/default.conf\fR in the \fIxmlrpc_uri\fR directive.
-.TP
-2. An unordered list of servers from the ldap DNS SRV records.
-
-.TP
-If a kerberos error is raised by any of the requests then it will stop processing and display the error message.
-.SH "FILES"
-.TP
-\fB/etc/ipa/default.conf\fR
-IPA default configuration file.
-.SH "EXIT STATUS"
-0 if the command was successful
-
-1 if an error occurred
-
-2 If an entry is not found
-.SH "SEE ALSO"
-ipa\-client\-install(1), ipa\-compat\-manage(1), ipactl(1), ipa\-dns\-install(1),
-ipa\-getcert(1), ipa\-getkeytab(1), ipa\-join(1), ipa\-ldap\-updater(1),
-ipa\-nis\-manage(1), ipa\-replica\-install(1), ipa\-replica\-manage(1), ipa\-replica\-prepare(1),
-ipa\-rmkeytab(1), ipa\-server\-certinstall(2), ipa\-server\-install(1), ipa\-server\-upgrade(1)
-
diff --git a/ipaclient/setup.py b/ipaclient/setup.py
new file mode 100644
index 0000000..66460e8
--- /dev/null
+++ b/ipaclient/setup.py
@@ -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 client library
+
+FreeIPA is a server for identity, policy, and audit.
+"""
+from ipasetup import ipasetup  # pylint: disable=relative-import
+
+ipasetup(
+    name="ipaclient",
+    doc=__doc__,
+    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",
+    ],
+)
diff --git a/ipaclient/setup.py.in b/ipaclient/setup.py.in
deleted file mode 100644
index 1c8654f..0000000
--- a/ipaclient/setup.py.in
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/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.
-"""
-
-DOCLINES = __doc__.split("\n")
-
-import os
-import sys
-
-CLASSIFIERS = """\
-Intended Audience :: System Environment/Base
-License :: GPL
-Programming Language :: Python
-Operating System :: POSIX
-Operating System :: Unix
-"""
-
-# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
-# update it when the contents of directories change.
-if os.path.exists('MANIFEST'):
-    os.remove('MANIFEST')
-
-def setup_package():
-
-    from distutils.core import setup
-
-    old_path = os.getcwd()
-    local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
-    os.chdir(local_path)
-    sys.path.insert(0,local_path)
-
-    try:
-        setup(
-            name = "ipaclient",
-            version = "__VERSION__",
-            license = "GPL",
-            url = "http://www.freeipa.org/";,
-            description = DOCLINES[0],
-            long_description = "\n".join(DOCLINES[2:]),
-            download_url = "http://www.freeipa.org/page/Downloads";,
-            classifiers=[line for line in CLASSIFIERS.split('\n') if line],
-            platforms = ["Linux", "Solaris", "Unix"],
-            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",
-            ],
-            scripts=['../ipa'],
-            data_files = [('share/man/man1', ["../ipa.1"])],
-        )
-    finally:
-        del sys.path[0]
-        os.chdir(old_path)
-    return
-
-if __name__ == '__main__':
-    setup_package()
diff --git a/ipalib/Makefile b/ipalib/Makefile
index 5bd84fa..135a03a 100644
--- a/ipalib/Makefile
+++ b/ipalib/Makefile
@@ -16,7 +16,7 @@ install:
 	fi
 
 clean:
-	rm -f *~ *.pyc __pycache__/
+	rm -rf *~ *.pyc __pycache__/
 
 distclean: clean
 	rm -f setup.py
diff --git a/ipalib/setup.py b/ipalib/setup.py
new file mode 100644
index 0000000..842e1d3
--- /dev/null
+++ b/ipalib/setup.py
@@ -0,0 +1,32 @@
+#!/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.
+"""
+from ipasetup import ipasetup  # pylint: disable=relative-import
+
+ipasetup(
+    name="ipalib",
+    doc=__doc__,
+    package_dir={'ipalib': ''},
+    packages=[
+        "ipalib",
+    ],
+)
diff --git a/ipalib/setup.py.in b/ipalib/setup.py.in
deleted file mode 100644
index 2af0834..0000000
--- a/ipalib/setup.py.in
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/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.
-"""
-
-DOCLINES = __doc__.split("\n")
-
-import os
-import sys
-
-CLASSIFIERS = """\
-Intended Audience :: System Environment/Base
-License :: GPL
-Programming Language :: Python
-Operating System :: POSIX
-Operating System :: Unix
-"""
-
-# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
-# update it when the contents of directories change.
-if os.path.exists('MANIFEST'):
-    os.remove('MANIFEST')
-
-def setup_package():
-
-    from distutils.core import setup
-
-    old_path = os.getcwd()
-    local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
-    os.chdir(local_path)
-    sys.path.insert(0,local_path)
-
-    try:
-        setup(
-            name = "ipalib",
-            version = "__VERSION__",
-            license = "GPL",
-            url = "http://www.freeipa.org/";,
-            description = DOCLINES[0],
-            long_description = "\n".join(DOCLINES[2:]),
-            download_url = "http://www.freeipa.org/page/Downloads";,
-            classifiers=[line for line in CLASSIFIERS.split('\n') if line],
-            platforms = ["Linux", "Solaris", "Unix"],
-            package_dir = {'ipalib': ''},
-            packages = ["ipalib"],
-        )
-    finally:
-        del sys.path[0]
-        os.chdir(old_path)
-    return
-
-if __name__ == '__main__':
-    setup_package()
diff --git a/ipaplatform/setup.py b/ipaplatform/setup.py
new file mode 100644
index 0000000..5507993
--- /dev/null
+++ b/ipaplatform/setup.py
@@ -0,0 +1,36 @@
+#!/usr/bin/python2
+# Copyright (C) 2014  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 platform
+
+FreeIPA is a server for identity, policy, and audit.
+"""
+from ipasetup import ipasetup  # pylint: disable=relative-import
+
+ipasetup(
+    name="ipaplatform",
+    doc=__doc__,
+    package_dir={'ipaplatform': ''},
+    packages=[
+        "ipaplatform",
+        "ipaplatform.base",
+        "ipaplatform.fedora",
+        "ipaplatform.redhat",
+        "ipaplatform.rhel"
+    ],
+)
diff --git a/ipaplatform/setup.py.in b/ipaplatform/setup.py.in
deleted file mode 100644
index 11bb757..0000000
--- a/ipaplatform/setup.py.in
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/python2
-# Copyright (C) 2014  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 platform
-
-FreeIPA is a server for identity, policy, and audit.
-"""
-
-DOCLINES = __doc__.split("\n")
-
-import os
-import sys
-
-CLASSIFIERS = """\
-Development Status :: 4 - Beta
-Intended Audience :: System Environment/Base
-License :: GPL
-Programming Language :: Python
-Operating System :: POSIX
-Operating System :: Unix
-"""
-
-# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
-# update it when the contents of directories change.
-if os.path.exists('MANIFEST'):
-    os.remove('MANIFEST')
-
-def setup_package():
-
-    from distutils.core import setup
-
-    old_path = os.getcwd()
-    local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
-    os.chdir(local_path)
-    sys.path.insert(0, local_path)
-
-    try:
-        setup(
-            name = "ipaplatform",
-            version = "__VERSION__",
-            license = "GPL",
-            author = "FreeIPA Developers",
-            author_email = "freeipa-devel@redhat.com",
-            maintainer = "FreeIPA Developers",
-            maintainer_email = "freeipa-devel@redhat.com",
-            url = "http://www.freeipa.org/";,
-            description = DOCLINES[0],
-            long_description = "\n".join(DOCLINES[2:]),
-            download_url = "http://www.freeipa.org/page/Downloads";,
-            classifiers=[line for line in CLASSIFIERS.split('\n') if line],
-            package_dir = {'ipaplatform': ''},
-            packages = ["ipaplatform",
-                        "ipaplatform.base",
-                        "ipaplatform.fedora",
-                        "ipaplatform.redhat",
-                        "ipaplatform.rhel"],
-        )
-    finally:
-        del sys.path[0]
-        os.chdir(old_path)
-    return
-
-if __name__ == '__main__':
-    setup_package()
diff --git a/ipapython/Makefile b/ipapython/Makefile
index d262439..562d927 100644
--- a/ipapython/Makefile
+++ b/ipapython/Makefile
@@ -20,7 +20,7 @@ install:
 	done
 
 clean:
-	rm -f *~ *.pyc __pycache__/
+	rm -rf *~ *.pyc __pycache__/
 	@for subdir in $(SUBDIRS); do \
 		(cd $$subdir && $(MAKE) $@) || exit 1; \
 	done
diff --git a/ipapython/setup.py b/ipapython/setup.py
new file mode 100755
index 0000000..e2b9419
--- /dev/null
+++ b/ipapython/setup.py
@@ -0,0 +1,35 @@
+#!/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 python support library
+
+FreeIPA is a server for identity, policy, and audit.
+"""
+from ipasetup import ipasetup  # pylint: disable=relative-import
+
+ipasetup(
+    name="ipapython",
+    doc=__doc__,
+    package_dir={'ipapython': ''},
+    packages=[
+        "ipapython",
+        "ipapython.dnssec",
+        "ipapython.secrets",
+        "ipapython.install"
+    ],
+)
diff --git a/ipapython/setup.py.in b/ipapython/setup.py.in
deleted file mode 100755
index 3a4d126..0000000
--- a/ipapython/setup.py.in
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/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 python support library
-
-FreeIPA is a server for identity, policy, and audit.
-"""
-
-DOCLINES = __doc__.split("\n")
-
-import os
-import sys
-
-CLASSIFIERS = """\
-Development Status :: 4 - Beta
-Intended Audience :: System Environment/Base
-License :: GPL
-Programming Language :: Python
-Operating System :: POSIX
-Operating System :: Unix
-"""
-
-# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
-# update it when the contents of directories change.
-if os.path.exists('MANIFEST'):
-    os.remove('MANIFEST')
-
-def setup_package():
-
-    from distutils.core import setup
-
-    old_path = os.getcwd()
-    local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
-    os.chdir(local_path)
-    sys.path.insert(0,local_path)
-
-    try:
-        setup(
-            name = "ipapython",
-            version = "__VERSION__",
-            license = "GPL",
-            author = "Karl MacMillan, et.al.",
-            author_email = "kmacm...@redhat.com",
-            maintainer = "freeIPA Developers",
-            maintainer_email = "freeipa-devel@redhat.com",
-            url = "http://www.freeipa.org/";,
-            description = DOCLINES[0],
-            long_description = "\n".join(DOCLINES[2:]),
-            download_url = "http://www.freeipa.org/page/Downloads";,
-            classifiers=[line for line in CLASSIFIERS.split('\n') if line],
-            platforms = ["Linux", "Solaris", "Unix"],
-            package_dir = {'ipapython': ''},
-            packages = ["ipapython",
-                        "ipapython.dnssec",
-                        "ipapython.secrets",
-                        "ipapython.install"],
-        )
-    finally:
-        del sys.path[0]
-        os.chdir(old_path)
-    return
-
-if __name__ == '__main__':
-    setup_package()
diff --git a/ipasetup.py.in b/ipasetup.py.in
new file mode 100644
index 0000000..f291d22
--- /dev/null
+++ b/ipasetup.py.in
@@ -0,0 +1,71 @@
+#!/usr/bin/python2
+# Copyright (C) 2014  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/>.
+#
+import os
+import sys
+
+common_args = dict(
+    version="__VERSION__",
+    license="GPL",
+    author="FreeIPA Developers",
+    author_email="freeipa-devel@redhat.com",
+    maintainer="FreeIPA Developers",
+    maintainer_email="freeipa-devel@redhat.com",
+    url="http://www.freeipa.org/";,
+    download_url="http://www.freeipa.org/page/Downloads";,
+    platforms=["Linux", "Solaris", "Unix"],
+    classifiers=[
+        "Development Status :: 5 - Production/Stable",
+        ("Topic :: System :: Systems Administration :: "
+         "Authentication/Directory :: LDAP"),
+        "Topic :: Internet :: Name Service (DNS)",
+        "Intended Audience :: System Environment/Base",
+        "License :: GPL",
+        "Programming Language :: Python",
+        "Operating System :: POSIX",
+        "Operating System :: Unix",
+    ],
+)
+
+local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
+old_path = os.path.abspath(os.getcwd())
+
+
+def ipasetup(name, doc, **kwargs):
+    doclines = doc.split("\n")
+
+    setup_kwargs = common_args.copy()
+    setup_kwargs.update(
+        name=name,
+        description=doclines[0],
+        long_description="\n".join(doclines[:2]),
+        **kwargs
+    )
+    # exclude setup helpers from getting installed
+    epd = setup_kwargs.setdefault('exclude_package_data', {})
+    epd.setdefault('', []).extend(['*/setup.py', '*/ipasetup.py'])
+
+    os.chdir(local_path)
+    try:
+        # BEFORE importing distutils, remove MANIFEST. distutils doesn't
+        # properly update it when the contents of directories change.
+        if os.path.isfile('MANIFEST'):
+            os.unlink('MANIFEST')
+        from setuptools import setup
+        return setup(**setup_kwargs)
+    finally:
+        os.chdir(old_path)
diff --git a/ipatests/setup.py b/ipatests/setup.py
new file mode 100644
index 0000000..7743222
--- /dev/null
+++ b/ipatests/setup.py
@@ -0,0 +1,54 @@
+#!/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 tests
+
+FreeIPA is a server for identity, policy, and audit.
+"""
+from ipasetup import ipasetup  # pylint: disable=relative-import
+
+ipasetup(
+    name="ipatests",
+    doc=__doc__,
+    package_dir={'ipatests': ''},
+    packages=[
+        "ipatests",
+        "ipatests.pytest_plugins",
+        "ipatests.test_cmdline",
+        "ipatests.test_install",
+        "ipatests.test_integration",
+        "ipatests.test_ipalib",
+        "ipatests.test_ipapython",
+        "ipatests.test_ipaserver",
+        "ipatests.test_ipaserver.test_install",
+        "ipatests.test_pkcs10",
+        "ipatests.test_webui",
+        "ipatests.test_xmlrpc",
+        "ipatests.test_xmlrpc.tracker"
+    ],
+    scripts=['ipa-run-tests', 'ipa-test-config', 'ipa-test-task'],
+    package_data={
+        'ipatests': ['pytest.ini'],
+        'ipatests.test_install': ['*.update'],
+        'ipatests.test_integration': ['scripts/*'],
+        'ipatests.test_ipalib': ['data/*'],
+        'ipatests.test_pkcs10': ['*.csr'],
+        "ipatests.test_ipaserver": ['data/*'],
+        'ipatests.test_xmlrpc': ['data/*'],
+    }
+)
diff --git a/ipatests/setup.py.in b/ipatests/setup.py.in
deleted file mode 100644
index 18483b0..0000000
--- a/ipatests/setup.py.in
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/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 tests
-
-FreeIPA is a server for identity, policy, and audit.
-"""
-
-DOCLINES = __doc__.split("\n")
-
-import os
-import sys
-
-CLASSIFIERS = """\
-Development Status :: 4 - Beta
-Intended Audience :: System Environment/Base
-License :: GPL
-Programming Language :: Python
-Operating System :: POSIX
-Operating System :: Unix
-"""
-
-# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
-# update it when the contents of directories change.
-if os.path.exists('MANIFEST'):
-    os.remove('MANIFEST')
-
-def setup_package():
-
-    from distutils.core import setup
-
-    old_path = os.getcwd()
-    local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
-    os.chdir(local_path)
-    sys.path.insert(0, local_path)
-
-    try:
-        setup(
-            name = "ipatests",
-            version = "__VERSION__",
-            license = "GPL",
-            author = "FreeIPA Developers",
-            author_email = "freeipa-devel@redhat.com",
-            maintainer = "FreeIPA Developers",
-            maintainer_email = "freeipa-devel@redhat.com",
-            url = "http://www.freeipa.org/";,
-            description = DOCLINES[0],
-            long_description = "\n".join(DOCLINES[2:]),
-            download_url = "http://www.freeipa.org/page/Downloads";,
-            classifiers=[line for line in CLASSIFIERS.split('\n') if line],
-            package_dir = {'ipatests': ''},
-            packages = ["ipatests",
-                        "ipatests.pytest_plugins",
-                        "ipatests.test_cmdline",
-                        "ipatests.test_install",
-                        "ipatests.test_integration",
-                        "ipatests.test_ipalib",
-                        "ipatests.test_ipapython",
-                        "ipatests.test_ipaserver",
-                        "ipatests.test_ipaserver.test_install",
-                        "ipatests.test_pkcs10",
-                        "ipatests.test_webui",
-                        "ipatests.test_xmlrpc",
-                        "ipatests.test_xmlrpc.tracker"],
-            scripts=['ipa-run-tests', 'ipa-test-config', 'ipa-test-task'],
-            package_data = {
-                'ipatests': ['pytest.ini'],
-                'ipatests.test_install': ['*.update'],
-                'ipatests.test_integration': ['scripts/*'],
-                'ipatests.test_ipalib': ['data/*'],
-                'ipatests.test_pkcs10': ['*.csr'],
-                "ipatests.test_ipaserver": ['data/*'],
-                'ipatests.test_xmlrpc': ['data/*'],
-            }
-        )
-    finally:
-        del sys.path[0]
-        os.chdir(old_path)
-    return
-
-if __name__ == '__main__':
-    setup_package()
diff --git a/setup.py b/setup.py
index 960a8f2..7b95091 100755
--- a/setup.py
+++ b/setup.py
@@ -22,58 +22,15 @@
 """
 Python-level packaging using distutils.
 """
-
-from distutils.core import setup
-from distutils.command.install_data import install_data as _install_data
-from distutils.util import change_root, convert_path
-from distutils import log
 import ipalib
-import os
-
-class install_data(_install_data):
-    """Override the built-in install_data to gzip files once they
-       are installed.
-    """
-
-    def run(self):
-        # install_data is a classic class so super() won't work. Call it
-        # directly to copy the files first.
-        _install_data.run(self)
-
-        # Now gzip them
-        for f in self.data_files:
-            if isinstance(f, str):
-                # it's a simple file
-                f = convert_path(f)
-                cmd = '/bin/gzip %s/%s' % (self.install_dir, f)
-                log.info("gzipping %s/%s" % (self.install_dir, f))
-                os.system(cmd)
-            else:
-                # it's a tuple with path and a list of files
-                dir = convert_path(f[0])
-                if not os.path.isabs(dir):
-                    dir = os.path.join(self.install_dir, dir)
-                elif self.root:
-                    dir = change_root(self.root, dir)
+from ipasetup import ipasetup  # pylint: disable=relative-import
 
-                if f[1] == []:
-                    # If there are no files listed the user must be
-                    # trying to create an empty directory. So nothing
-                    # to do here.
-                    pass
-                else:
-                    # gzip the files
-                    for data in f[1]:
-                        data = convert_path(data)
-                        cmd = '/bin/gzip %s/%s' % (dir, data)
-                        log.info("gzipping %s/%s" % (dir, data))
-                        os.system(cmd)
 
-setup(
+ipasetup(
     name='freeipa',
+    doc=__doc__,
     version=ipalib.__version__,
-    license='GPLv3+',
-    url='http://freeipa.org/',
+    scripts=['ipa'],
     packages=[
         'ipaserver',
         'ipaserver.advise',
-- 
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

Reply via email to