summaryrefslogtreecommitdiff
path: root/setuptools/dist.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/dist.py')
-rw-r--r--setuptools/dist.py168
1 files changed, 36 insertions, 132 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 01889215..c5b02f99 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -1,17 +1,19 @@
__all__ = ['Distribution']
import re
+import os
import sys
+import warnings
+import distutils.log
+import distutils.core
+import distutils.cmd
from distutils.core import Distribution as _Distribution
+from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
+ DistutilsSetupError)
+
from setuptools.depends import Require
-from setuptools.command.install import install
-from setuptools.command.sdist import sdist
-from setuptools.command.install_lib import install_lib
from setuptools.compat import numeric_types, basestring
-from distutils.errors import DistutilsOptionError, DistutilsPlatformError
-from distutils.errors import DistutilsSetupError
-import setuptools, pkg_resources, distutils.core, distutils.dist, distutils.cmd
-import os, distutils.log
+import pkg_resources
def _get_unpatched(cls):
"""Protect against re-patching the distutils if reloaded
@@ -132,38 +134,6 @@ def check_packages(dist, attr, value):
"WARNING: %r not a valid package name; please use only"
".-separated package names in setup.py", pkgname
)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class Distribution(_Distribution):
@@ -194,7 +164,8 @@ class Distribution(_Distribution):
EasyInstall and requests one of your extras, the corresponding
additional requirements will be installed if needed.
- 'features' -- a dictionary mapping option names to 'setuptools.Feature'
+ 'features' **deprecated** -- a dictionary mapping option names to
+ 'setuptools.Feature'
objects. Features are a portion of the distribution that can be
included or excluded based on user options, inter-feature dependencies,
and availability on the current system. Excluded features are omitted
@@ -248,10 +219,13 @@ class Distribution(_Distribution):
dist._version = pkg_resources.safe_version(str(attrs['version']))
self._patched_dist = dist
- def __init__ (self, attrs=None):
+ def __init__(self, attrs=None):
have_package_data = hasattr(self, "package_data")
if not have_package_data:
self.package_data = {}
+ _attrs_dict = attrs or {}
+ if 'features' in _attrs_dict or 'require_features' in _attrs_dict:
+ Feature.warn_deprecated()
self.require_features = []
self.features = {}
self.dist_files = []
@@ -362,23 +336,6 @@ class Distribution(_Distribution):
self.global_options = self.feature_options = go + self.global_options
self.negative_opt = self.feature_negopt = no
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
def _finalize_features(self):
"""Add/remove features and resolve dependencies between them"""
@@ -396,7 +353,6 @@ class Distribution(_Distribution):
feature.exclude_from(self)
self._set_feature(name,0)
-
def get_command_class(self, command):
"""Pluggable version of get_command_class()"""
if command in self.cmdclass:
@@ -416,10 +372,6 @@ class Distribution(_Distribution):
self.cmdclass[ep.name] = cmdclass
return _Distribution.print_commands(self)
-
-
-
-
def _set_feature(self,name,status):
"""Set feature's inclusion status"""
setattr(self,self._feature_attrname(name),status)
@@ -434,8 +386,8 @@ class Distribution(_Distribution):
if self.feature_is_included(name)==0:
descr = self.features[name].description
raise DistutilsOptionError(
- descr + " is required, but was excluded or is not available"
- )
+ descr + " is required, but was excluded or is not available"
+ )
self.features[name].include_in(self)
self._set_feature(name,1)
@@ -483,7 +435,6 @@ class Distribution(_Distribution):
if p.name != package and not p.name.startswith(pfx)
]
-
def has_contents_for(self,package):
"""Return true if 'exclude_package(package)' would do something"""
@@ -493,15 +444,6 @@ class Distribution(_Distribution):
if p==package or p.startswith(pfx):
return True
-
-
-
-
-
-
-
-
-
def _exclude_misc(self,name,value):
"""Handle 'exclude()' for list/tuple attrs without a special handler"""
if not isinstance(value,sequence):
@@ -573,17 +515,6 @@ class Distribution(_Distribution):
)
list(map(self.exclude_package, packages))
-
-
-
-
-
-
-
-
-
-
-
def _parse_command_opts(self, parser, args):
# Remove --with-X/--without-X options when processing command args
self.global_options = self.__class__.global_options
@@ -610,21 +541,6 @@ class Distribution(_Distribution):
return nargs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
def get_cmdline_options(self):
"""Return a '{cmd: {opt:val}}' map of all command-line options
@@ -665,7 +581,6 @@ class Distribution(_Distribution):
return d
-
def iter_distribution_names(self):
"""Yield all packages, modules, and extension names in distribution"""
@@ -684,7 +599,6 @@ class Distribution(_Distribution):
name = name[:-6]
yield name
-
def handle_display_options(self, option_order):
"""If there were any non-global "display-only" options
(--help-commands or the metadata display options) on the command
@@ -726,26 +640,14 @@ for module in distutils.dist, distutils.core, distutils.cmd:
module.Distribution = Distribution
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class Feature:
- """A subset of the distribution that can be excluded if unneeded/wanted
+ """
+ **deprecated** -- The `Feature` facility was never completely implemented
+ or supported, `has reported issues
+ <https://bitbucket.org/pypa/setuptools/issue/58>`_ and will be removed in
+ a future version.
+
+ A subset of the distribution that can be excluded if unneeded/wanted
Features are created using these keyword arguments:
@@ -794,9 +696,19 @@ class Feature:
Aside from the methods, the only feature attributes that distributions look
at are 'description' and 'optional'.
"""
+
+ @staticmethod
+ def warn_deprecated():
+ warnings.warn(
+ "Features are deprecated and will be removed in a future "
+ "version. See http://bitbucket.org/pypa/setuptools/65.",
+ DeprecationWarning,
+ stacklevel=3,
+ )
+
def __init__(self, description, standard=False, available=True,
- optional=True, require_features=(), remove=(), **extras
- ):
+ optional=True, require_features=(), remove=(), **extras):
+ self.warn_deprecated()
self.description = description
self.standard = standard
@@ -847,8 +759,6 @@ class Feature:
for f in self.require_features:
dist.include_feature(f)
-
-
def exclude_from(self,dist):
"""Ensure feature is excluded from distribution
@@ -865,8 +775,6 @@ class Feature:
for item in self.remove:
dist.exclude_package(item)
-
-
def validate(self,dist):
"""Verify that feature makes sense in context of distribution
@@ -886,7 +794,3 @@ class Feature:
" doesn't contain any packages or modules under %s"
% (self.description, item, item)
)
-
-
-
-