Skip to content

Commit

Permalink
fix: do not change format of Python version files (#782)
Browse files Browse the repository at this point in the history
Fixes: #777

Co-authored-by: Benjamin E. Coe <[email protected]>
  • Loading branch information
targos and bcoe authored Feb 20, 2021
1 parent fb9aa22 commit 10f7ab9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions __snapshots__/python.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion __snapshots__/version-py.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ exports['version.py updateContent updates version in version.py 1'] = `
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "0.6.0"
__version__ = '0.6.0'
`
4 changes: 2 additions & 2 deletions src/updaters/python/setup-cfg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export class SetupCfg implements Update {
}
updateContent(content: string): string {
return content.replace(
/version ?= ?[0-9]+\.[0-9]+\.[0-9](-\w+)?/,
`version = ${this.version}`
/(version ?= ?)[0-9]+\.[0-9]+\.[0-9](?:-\w+)?/,
`$1${this.version}`
);
}
}
4 changes: 2 additions & 2 deletions src/updaters/python/setup-py.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export class SetupPy implements Update {
}
updateContent(content: string): string {
return content.replace(
/version ?= ?["'][0-9]+\.[0-9]+\.[0-9](-\w+)?["']/,
`version = "${this.version}"`
/(version ?= ?["'])[0-9]+\.[0-9]+\.[0-9](?:-\w+)?(["'])/,
`$1${this.version}$2`
);
}
}
4 changes: 2 additions & 2 deletions src/updaters/python/version-py.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export class VersionPy implements Update {
}
updateContent(content: string): string {
return content.replace(
/__version__ ?= ?["'][0-9]+\.[0-9]+\.[0-9](-\w+)?["']/,
`__version__ = "${this.version}"`
/(__version__ ?= ?["'])[0-9]+\.[0-9]+\.[0-9](?:-\w+)?(["'])/,
`$1${this.version}$2`
);
}
}
2 changes: 1 addition & 1 deletion test/updaters/fixtures/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.5.0"
__version__ = '0.5.0'

0 comments on commit 10f7ab9

Please sign in to comment.