-
Notifications
You must be signed in to change notification settings - Fork 987
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 Python 3 compatibility to bin/cordova_plist_to_config_xml #769
Conversation
These changes should be compatible with both Python 2 and Python 3.
Codecov Report
@@ Coverage Diff @@
## master #769 +/- ##
=======================================
Coverage 74.42% 74.42%
=======================================
Files 11 11
Lines 1830 1830
=======================================
Hits 1362 1362
Misses 468 468 Continue to review full report at Codecov.
|
Thanks for the contribution, I just requested a review from some iOS experts. My apologies for the delay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
If have no idea about python, that's why I got someone to review it who has :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After another look at the script, I now start to wonder if we could find a better way to solve the same problem with Cordova.plist and config.xml. A couple ideas I can think of:
- do this in a Node.js script, with help from our Cordova node-xcode utility
- update the Cordova xcode project to use the correct configuration from config.xml, with no dynamic fix needed
Just as a side-note, this file seems to be used only for the Platform-Centered workflow. There are multiple ways of going about creating a Platform-Centered project. One is a fresh project from Xcode. This means the Cordova's Xcode based project is not used and therefore does not have the IMO, I think we do not have a lot of resources to focus on the Platform-Center workflow. I think it may have been discussed to consolidate our focus only on the CLI workflow and potentially dropping Platform-Center workflow. If the changes work, we could just push it through and not spend too much time on this. Just My Opinion... |
Agreed @erisu, let's get this merged.
|
I think we want to drop this functionality in the near future, as I proposed in apache/cordova#198. I wonder if we can get this fix into a minor release somehow. What do you think @erisu? @erisu let's please get this merged in the next 12-24 hours if there are no objections, I do think it would be good to get this solution committed even if we do not want to support it too much longer. |
@@ -106,7 +106,7 @@ def UpdateProjectFile(path): | |||
if 'Cordova.plist' in line: | |||
line = line.replace('Cordova.plist', 'config.xml') | |||
line = line.replace('lastKnownFileType = text.plist.xml', 'lastKnownFileType = text.xml') | |||
print(line, end='') | |||
print(line, end=' ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add a space here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To put a space between each line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand (did not work with Python for about 10 years), hope someone else can review it. We do appreciate your efforts to get this whole Python compatibility issue fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which do we want?
>>> for char in "abcdefg":
... print(char, end="") # --> abcdefg
-- or --
>>> for char in "abcdefg":
... print(char, end=" ") # --> a b c d e f g
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering this script is now necessary or not.
Because Cordova.plist
is removed at the commit https://github.com/apache/cordova-ios/tree/321420b9c3520b0cf32e5b27117701d3ced760b4/bin/templates/project/__TESTING__
. The last of Cordova.plist
is in the previous commit https://github.com/apache/cordova-ios/tree/df186efa37406f4347218e33b264aec6e0110194/bin/templates/project/__TESTING__
. This date is 10 Nov 2012. I imagine the role of this script is to convert old style Cordova.plist
to new style config.xml
and not necessary now.
When we apply this script to usual Xcode project, the error
raise Exception('Could not find a file named "Cordova.plist" within ' + search_path)
happens because there is no Cordova.plist
file.
Or if we rename some Info.plist to Cordova.plist
the another error
AppendDict(plist['Plugins'], plugins, 'plugin')
KeyError: 'Plugins'
happens because (usually) plist file does not contains the key Plugins
. This key is old cordova style proejct specific feature. The error happens on about line 90,
AppendDict(plist['Plugins'], plugins, 'plugin') # <--- plist['Plugins'] exists only for old cordova style (before cordova-ios 2.3) project.
I tried this PR with Python 3.6.4. But I got the following error.
I feel it is better to use
|
As suggested at apache#769 (comment)
These changes should be compatible with both Python 2 and Python 3.
Platforms affected
Motivation and Context
Description
Testing
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)