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

[BUG] Exception is thrown when finding productRef instead of fileRef #352

Closed
OmarIthawi opened this issue Jun 21, 2024 · 0 comments · Fixed by #353
Closed

[BUG] Exception is thrown when finding productRef instead of fileRef #352

OmarIthawi opened this issue Jun 21, 2024 · 0 comments · Fixed by #353
Labels

Comments

@OmarIthawi
Copy link
Contributor

Describe the bug

Exception is thrown when finding productRef instead of fileRef.

BAF0D4CB2AD6AE14007AC334 /* FacebookLogin in Frameworks */ = {isa = PBXBuildFile; productRef = BAF0D4CA2AD6AE14007AC334 /* FacebookLogin */; };

Exception is thrown when trying to remove unrelated files:

Error: An unexpected error occurred in clean_translation_files: 'PBXBuildFile' object has no attribute 'fileRef'
Traceback (most recent call last):
  File "/home/omar/work/openedx/openedx-app-ios/i18n_scripts/translation.py", line 394, in <module>
    main()
  File "/home/omar/work/openedx/openedx-app-ios/i18n_scripts/translation.py", line 390, in main
    clean_translation_files()
  File "/home/omar/work/openedx/openedx-app-ios/i18n_scripts/translation.py", line 335, in clean_translation_files
    xcode_project.remove_files_by_path(file_ref.path, tree=LOCALIZABLE_FILES_TREE)
  File "/home/omar/.virtualenvs/openedx-app-ios/lib/python3.10/site-packages/pbxproj/pbxextensions/ProjectFiles.py", line 366, in remove_files_by_path
    if self.remove_file_by_id(file_ref.get_id(), target_name=target_name):
  File "/home/omar/.virtualenvs/openedx-app-ios/lib/python3.10/site-packages/pbxproj/pbxextensions/ProjectFiles.py", line 332, in remove_file_by_id
    if build_file.fileRef == file_ref.get_id():
AttributeError: 'PBXBuildFile' object has no attribute 'fileRef'
make: *** [Makefile:3: clean_translations] Error 1

System information

  1. pbxproj version used: 4.1.0
  2. python version used: 3.10.12
  3. Xcode version used: I don't know, I use the version on https://github.com/openedx/openedx-app-ios/blob/b2539a6f0ee00a06879f3820d438430a4346363e/Core/Core.xcodeproj/project.pbxproj#L1-L8 and I have no XCode on my Linux machine

To Reproduce
Steps to reproduce the behavior:

TBD: Add more details here

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
The file is added despite productRef exists somewhere else.

Screenshots
None.

Additional context
We're trying to add generated files, and XCode doesn't cooperate without mod-pbxproj help.

Related issues

@OmarIthawi OmarIthawi added the bug label Jun 21, 2024
@OmarIthawi OmarIthawi changed the title [BUG] [BUG] Exception is thrown when finding productRef instead of fileRef Jun 22, 2024
OmarIthawi added a commit to Zeit-Labs/mod-pbxproj that referenced this issue Jun 22, 2024
fix the exception below:

```
  File "pbxproj/pbxextensions/ProjectFiles.py", line 332, in remove_file_by_id
    if build_file.fileRef == file_ref.get_id():
AttributeError: 'PBXBuildFile' object has no attribute 'fileRef'
```

Fixes kronenthaler#352
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants