Skip to content

Commit 3ceab3b

Browse files
authored
prepare_release script to ignore some packages/files (#885)
1 parent 14d0726 commit 3ceab3b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

eachdist.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ packages=
4141
opentelemetry-semantic-conventions
4242
opentelemetry-test-utils
4343
opentelemetry-instrumentation
44+
opentelemetry-distro
45+
46+
[exclude_release]
47+
packages=
48+
opentelemetry-sdk-extension-aws
49+
opentelemetry-propagator-aws-xray
4450

4551
[lintroots]
4652
extraroots=examples/*,scripts/

scripts/eachdist.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
DEFAULT_ALLSEP = " "
1818
DEFAULT_ALLFMT = "{rel}"
1919

20+
NON_SRC_DIRS = ["build", "dist", "__pycache__", "lib", "venv", ".tox"]
21+
2022

2123
def unique(elems):
2224
seen = set()
@@ -591,7 +593,17 @@ def update_changelogs(version):
591593

592594

593595
def find(name, path):
596+
non_src_dirs = [os.path.join(path, nsd) for nsd in NON_SRC_DIRS]
597+
598+
def _is_non_src_dir(root) -> bool:
599+
for nsd in non_src_dirs:
600+
if root.startswith(nsd):
601+
return True
602+
return False
603+
594604
for root, _, files in os.walk(path):
605+
if _is_non_src_dir(root):
606+
continue
595607
if name in files:
596608
return os.path.join(root, name)
597609
return None
@@ -669,13 +681,16 @@ def release_args(args):
669681
cfg.read(str(find_projectroot() / "eachdist.ini"))
670682
versions = args.versions
671683
updated_versions = []
684+
685+
excluded = cfg["exclude_release"]["packages"].split()
686+
targets = [target for target in targets if basename(target) not in excluded]
672687
for group in versions.split(","):
673688
mcfg = cfg[group]
674689
version = mcfg["version"]
675690
updated_versions.append(version)
676691
packages = None
677692
if "packages" in mcfg:
678-
packages = mcfg["packages"].split()
693+
packages = [pkg for pkg in mcfg["packages"].split() if pkg not in excluded]
679694
print(f"update {group} packages to {version}")
680695
update_dependencies(targets, version, packages)
681696
update_version_files(targets, version, packages)

0 commit comments

Comments
 (0)