Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --exlcude option #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions libpip2pi/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
import sys
import shutil
import fnmatch
import atexit
import tempfile
import warnings
Expand Down Expand Up @@ -229,6 +230,11 @@ def add_index_options(self):
using something like mod_autoindex and you want to make older
package/module versions continue to be available.
"""))
self.add_option(
'-X', '--exclude', dest="exclude", metavar="SHELLGLOB",
help=dedent("""
Exclude files in PACKAGE_DIR whose basename matches SHELLGLOB.
"""))
self.add_option(
'-z', '--also-get-source', dest="get_source", action="store_true",
default=False, help=dedent("""
Expand Down Expand Up @@ -353,6 +359,8 @@ def _dir2pi(option, argv):
pkg_basename = os.path.basename(file)
if pkg_basename.startswith("."):
continue
if option.exclude and fnmatch.fnmatchcase(pkg_basename, option.exclude):
continue
pkg_name, pkg_rest = file_to_package(pkg_basename, pkgdir)

pkg_dir_name = pkg_name
Expand Down