Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ setuptools>=21.0.0 # PSF/ZPL
urllib3>=1.19.1,!=1.21 # MIT
pyyaml>=3.12 # MIT
google-auth>=1.0.1 # Apache-2.0
ipaddress>=1.0.17 # PSF
ipaddress>=1.0.17;python_version=="2.7" # PSF
websocket-client>=0.32.0,!=0.40.0,!=0.41.*,!=0.42.* # LGPLv2+
requests # Apache-2.0
requests-oauthlib # ISC
15 changes: 13 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from setuptools import find_packages, setup
from setuptools import setup

# Do not edit these constants. They will be updated automatically
# by scripts/update-client.sh.
Expand All @@ -27,8 +27,18 @@
# prerequisite: setuptools
# http://pypi.python.org/pypi/setuptools

EXTRAS = {}
REQUIRES = []
with open('requirements.txt') as f:
REQUIRES = f.readlines()
for line in f:
line, _, _ = line.partition('#')
line = line.strip()
if ';' in line:
requirement, _, specifier = line.partition(';')
for_specifier = EXTRAS.setdefault(':{}'.format(specifier), [])
for_specifier.append(requirement)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the purpose of "for_specifier.append(requirement)" but for_specifier is not kept anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for_specifier is the list inside EXTRAS[f":{spec}"] -- I'd use collections.defaultdict(list) here but setuptools requires specific types here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trick here is setdefault

else:
REQUIRES.append(line)

with open('test-requirements.txt') as f:
TESTS_REQUIRES = f.readlines()
Expand All @@ -44,6 +54,7 @@
keywords=["Swagger", "OpenAPI", "Kubernetes"],
install_requires=REQUIRES,
tests_require=TESTS_REQUIRES,
extras_require=EXTRAS,
packages=['kubernetes', 'kubernetes.client', 'kubernetes.config',
'kubernetes.watch', 'kubernetes.client.apis',
'kubernetes.stream', 'kubernetes.client.models'],
Expand Down