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 --package-name option to pcreate. #2783

Merged
merged 2 commits into from Oct 3, 2016

Conversation

Projects
None yet
3 participants
@goodwillcoding
Copy link
Member

commented Oct 3, 2016

This solves the problem of scaffold creating an existing directory where the package created should not be named after the base folder. For example if I am in I run pcreate in ~/code/trypyramid.com and
would like to create package called tpc this is currently impossible. This solves the issues by allowing me to specify the package name on the command line.

Note: I'll add changelog changes post review

Add --package-name option to pcreate. This solves the problem
of scaffold creating an existing directory where the package
created should not be named after the base folder.
For example if I am in I run pcreate in ~/code/trypyramid.com and
would like to create package called tpc this is currently
impossible. This solves the issues by allowing me to specify
the package name on the command line
safe_name = pkg_resources.safe_name(project_name)
if self.options.package_name is None:
pkg_name = _bad_chars_re.sub(
'', project_name.lower().replace('-', '_'))

This comment has been minimized.

Copy link
@mmerickel

mmerickel Oct 3, 2016

Member

Is this code not run on the project name if --package-name is not specified? It seems the pkg_name should be normalized in one spot.

This comment has been minimized.

Copy link
@goodwillcoding

goodwillcoding Oct 3, 2016

Author Member

That's existing code though, unmodified.

This comment has been minimized.

Copy link
@goodwillcoding

goodwillcoding Oct 3, 2016

Author Member

The only change is if package name is given it is assumed to be safe and hence assigned in the else block. The assumption of safety is documented in help for pcreate

This comment has been minimized.

Copy link
@mmerickel

mmerickel Oct 3, 2016

Member

Sorry I read that test wrong, I thought it was is not None. So are we not validating the package name if you specify --package-name?

This comment has been minimized.

Copy link
@goodwillcoding

goodwillcoding Oct 3, 2016

Author Member

We are not validating it. Rationale being: if user provide the package name then it's a case where they want a specific one and hence need to know if it is safe. I can add validation of course if you think it is needed.

This comment has been minimized.

Copy link
@mmerickel

mmerickel Oct 3, 2016

Member

Where is the assumption of safety documented? I don't get that from reading the help. Maybe rephrase that sentence slightly because I think has to be a valid python package name implies that it will be validated. Perhaps Assumed to be a valid python package name.

This comment has been minimized.

Copy link
@goodwillcoding

goodwillcoding Oct 3, 2016

Author Member

Fixed verbiage, and pushed.

update pcreate --package-name help with better verbiage which
more explicitly states that package name is assumed to be safe

@bertjwregeer bertjwregeer merged commit 11cbc8f into Pylons:master Oct 3, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@bertjwregeer

This comment has been minimized.

Copy link
Member

commented Oct 3, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.