briefcase icon indicating copy to clipboard operation
briefcase copied to clipboard

Incomplete deletion of old project not correctly idenfied

Open freakboy3742 opened this issue 4 years ago • 16 comments

Originally reported as a side effect of #300

If you have previously run briefcase create for a given app, you'll be warned, and prompted to delete the old app:

(beeware-venv) lov080@DARKZERO-LN helloworld % briefcase create iOS            

Application helloworld already exists; overwrite (y/N)? y

Briefcase currently assumes that the app deletion is complete.

However, if something prevents the app from being deleted (e.g., an open terminal session, or the app being currently open, you will get an error:

[helloworld] Removing old application bundle...
Traceback (most recent call last):
  File "/Users/lov080/Google Drive/Python/BeeWare/examples/beeware-tutorial/beeware-venv/bin/briefcase", line 12, in <module>
    sys.exit(main())
  File "/Users/lov080/Google Drive/Python/BeeWare/examples/beeware-tutorial/beeware-venv/lib/python3.8/site-packages/briefcase/__main__.py", line 11, in main
    command(**options)
  File "/Users/lov080/Google Drive/Python/BeeWare/examples/beeware-tutorial/beeware-venv/lib/python3.8/site-packages/briefcase/commands/create.py", line 610, in __call__
    state = self.create_app(app, **full_kwargs(state, kwargs))
  File "/Users/lov080/Google Drive/Python/BeeWare/examples/beeware-tutorial/beeware-venv/lib/python3.8/site-packages/briefcase/commands/create.py", line 564, in create_app
    self.shutil.rmtree(str(bundle_path))
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 730, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 612, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 610, in _rmtree_unsafe
    os.rmdir(path)
OSError: [Errno 66] Directory not empty: '/Users/lov080/Google Drive/Python/BeeWare/examples/beeware-tutorial/helloworld/iOS/Hello World'

but the create command will continue, resulting in a state where the app hasn't been recreated.

This edge case needs to be caught and corrected - we should check that the deletion completed without error before creating the new app.

freakboy3742 avatar May 10 '20 03:05 freakboy3742

Hi @freakboy3742 - Can I work on this. I'm new to open source and I would be a great way for me to get involved.

rajat641 avatar May 13 '20 07:05 rajat641

@rajat641 Absolutely! If you have any questions, or need any pointers, let us know!

freakboy3742 avatar May 13 '20 10:05 freakboy3742

Hi @freakboy3742. I am new to open source. I briefly went through the beeware tutorial on briefcase. Can you provide some additional details like the code files to refer or prerequisites that might be required for this task?

nihit97natu avatar Jun 02 '20 23:06 nihit97natu

@nihit97natu Step one in any debugging task is to reproduce the problem. Use the details we have (listed in the ticket) to see if you can cause the same problem to occur on your own setup.

Step two is to encode that mode of failure as a failing test case. Write an automated test (or tests) that represent the problem. This test will fail on the current codebase.

Step three: make the test pass.

In this case, the problem code will almost certainly be in the implementation of the create command (src/briefcase/create.py); but you shouldn't start looking at the code until you can reproduce the problem.

freakboy3742 avatar Jun 03 '20 00:06 freakboy3742

Hi, I am new to open source. Can I contribute to this, please?

pratheekcr avatar Jan 10 '21 02:01 pratheekcr

Absolutely! We don't a strong formal process for "taking" a ticket - just drop a comment on the ticket you're planning to work on, and submit a PR; as long as it looks like you're making active progress on the issue, we'll discourage anyone else from working on the same ticket.

freakboy3742 avatar Jan 10 '21 22:01 freakboy3742

Thanks @freakboy3742 Is there a chatroom for any open questions?

pratheekcr avatar Jan 13 '21 05:01 pratheekcr

@pratheekcr Yes: https://gitter.im/beeware/general is our chat room.

freakboy3742 avatar Jan 13 '21 06:01 freakboy3742