@@ -33,7 +33,6 @@ load(":whl_target_platforms.bzl", "whl_target_platforms")
3333
3434_CPPFLAGS = "CPPFLAGS"
3535_COMMAND_LINE_TOOLS_PATH_SLUG = "commandlinetools"
36- _WHEEL_ENTRY_POINT_PREFIX = "rules_python_wheel_entry_point"
3736
3837def _get_xcode_location_cflags (rctx , logger = None ):
3938 """Query the xcode sdk location to update cflags
@@ -443,38 +442,13 @@ def _whl_library_impl(rctx):
443442 )
444443 namespace_package_files = pypi_repo_utils .find_namespace_package_files (rctx , install_dir_path )
445444
446- # NOTE @aignas 2024-06-22: this has to live on until we stop supporting
447- # passing `twine` as a `:pkg` library via the `WORKSPACE` builds.
448- #
449- # See ../../packaging.bzl line 190
450- entry_points = {}
451- for item in metadata .entry_points :
452- name = item .name
453- module = item .module
454- attribute = item .attribute
455-
456- # There is an extreme edge-case with entry_points that end with `.py`
457- # See: https://github.com/bazelbuild/bazel/blob/09c621e4cf5b968f4c6cdf905ab142d5961f9ddc/src/test/java/com/google/devtools/build/lib/rules/python/PyBinaryConfiguredTargetTest.java#L174
458- entry_point_without_py = name [:- 3 ] + "_py" if name .endswith (".py" ) else name
459- entry_point_target_name = (
460- _WHEEL_ENTRY_POINT_PREFIX + "_" + entry_point_without_py
461- )
462- entry_point_script_name = entry_point_target_name + ".py"
463-
464- rctx .file (
465- entry_point_script_name ,
466- _generate_entry_point_contents (module , attribute ),
467- )
468- entry_points [entry_point_without_py ] = entry_point_script_name
469-
470445 build_file_contents = generate_whl_library_build_bazel (
471446 name = whl_path .basename ,
472447 sdist_filename = sdist_filename ,
473448 dep_template = rctx .attr .dep_template or "@{}{{name}}//:{{target}}" .format (
474449 rctx .attr .repo_prefix ,
475450 ),
476451 config_load = rctx .attr .config_load ,
477- entry_points = entry_points ,
478452 metadata_name = metadata .name ,
479453 metadata_version = metadata .version ,
480454 requires_dist = metadata .requires_dist ,
@@ -492,37 +466,12 @@ def _whl_library_impl(rctx):
492466 metadata = json .decode (rctx .read ("metadata.json" ))
493467 rctx .delete ("metadata.json" )
494468
495- # NOTE @aignas 2024-06-22: this has to live on until we stop supporting
496- # passing `twine` as a `:pkg` library via the `WORKSPACE` builds.
497- #
498- # See ../../packaging.bzl line 190
499- entry_points = {}
500- for item in metadata ["entry_points" ]:
501- name = item ["name" ]
502- module = item ["module" ]
503- attribute = item ["attribute" ]
504-
505- # There is an extreme edge-case with entry_points that end with `.py`
506- # See: https://github.com/bazelbuild/bazel/blob/09c621e4cf5b968f4c6cdf905ab142d5961f9ddc/src/test/java/com/google/devtools/build/lib/rules/python/PyBinaryConfiguredTargetTest.java#L174
507- entry_point_without_py = name [:- 3 ] + "_py" if name .endswith (".py" ) else name
508- entry_point_target_name = (
509- _WHEEL_ENTRY_POINT_PREFIX + "_" + entry_point_without_py
510- )
511- entry_point_script_name = entry_point_target_name + ".py"
512-
513- rctx .file (
514- entry_point_script_name ,
515- _generate_entry_point_contents (module , attribute ),
516- )
517- entry_points [entry_point_without_py ] = entry_point_script_name
518-
519469 namespace_package_files = pypi_repo_utils .find_namespace_package_files (rctx , rctx .path ("site-packages" ))
520470
521471 build_file_contents = generate_whl_library_build_bazel (
522472 name = whl_path .basename ,
523473 sdist_filename = sdist_filename ,
524474 dep_template = rctx .attr .dep_template or "@{}{{name}}//:{{target}}" .format (rctx .attr .repo_prefix ),
525- entry_points = entry_points ,
526475 # TODO @aignas 2025-05-17: maybe have a build flag for this instead
527476 enable_implicit_namespace_pkgs = rctx .attr .enable_implicit_namespace_pkgs ,
528477 # TODO @aignas 2025-04-14: load through the hub:
@@ -568,34 +517,6 @@ def _remove_files(rctx, *basenames):
568517 elif path .is_dir :
569518 paths .extend (path .readdir ())
570519
571- def _generate_entry_point_contents (
572- module ,
573- attribute ,
574- shebang = "#!/usr/bin/env python3" ):
575- """Generate the contents of an entry point script.
576-
577- Args:
578- module (str): The name of the module to use.
579- attribute (str): The name of the attribute to call.
580- shebang (str, optional): The shebang to use for the entry point python
581- file.
582-
583- Returns:
584- str: A string of python code.
585- """
586- contents = """\
587- {shebang}
588- import sys
589- from {module} import {attribute}
590- if __name__ == "__main__":
591- sys.exit({attribute}())
592- """ .format (
593- shebang = shebang ,
594- module = module ,
595- attribute = attribute ,
596- )
597- return contents
598-
599520# NOTE @aignas 2024-03-21: The usage of dict({}, **common) ensures that all args to `dict` are unique
600521whl_library_attrs = dict ({
601522 "annotation" : attr .label (
0 commit comments