seemoo-lab / opendrop

An open Apple AirDrop implementation written in Python
https://owlink.org
GNU General Public License v3.0
8.63k stars 273 forks source link

Moved code to src dir & brought setup files to python3 standards #46

Closed vinaysb closed 3 years ago

vinaysb commented 4 years ago

Ok great, I made the changes in my fork. I had to change the tree structure, by having an intermediary src folder, otherwise, relative imports would break.

The cfg file also has support for coverage.rc, doc8.ini files that can be used for testing with Travis

vinaysb commented 4 years ago

Based on Issue #45

Sn0wfreezeDev commented 4 years ago

Hi,

Thank you for your contribution. I reviewed the code of your pull request and to me it looks good. I tried a merge locally and it results in an install error with pip3 (pip 20.2) - python 3.7 The current master succeeds in building.

It seems to be related to Setuptools, but I cannot clearly get why it's failing. Maybe, you can have a look at it and resubmit the changes?

Here's the build log.

Processing /Users/seemoo/Work/Research/OWL/OpenDrop/pull_requests/opendrop
Requirement already satisfied: Pillow in /usr/local/lib/python3.7/site-packages (from opendrop==0.11.0) (7.0.0)
Requirement already satisfied: ctypescrypto in /usr/local/lib/python3.7/site-packages (from opendrop==0.11.0) (0.5)
Requirement already satisfied: fleep in /usr/local/lib/python3.7/site-packages (from opendrop==0.11.0) (1.0.1)
Requirement already satisfied: ifaddr in /usr/local/lib/python3.7/site-packages (from opendrop==0.11.0) (0.1.6)
Requirement already satisfied: libarchive-c in /usr/local/lib/python3.7/site-packages (from opendrop==0.11.0) (2.9)
Requirement already satisfied: requests in /usr/local/lib/python3.7/site-packages (from opendrop==0.11.0) (2.22.0)
Collecting requests_toolbelt
  Downloading requests_toolbelt-0.9.1-py2.py3-none-any.whl (54 kB)
     |████████████████████████████████| 54 kB 1.7 MB/s
Requirement already satisfied: click in /usr/local/lib/python3.7/site-packages (from opendrop==0.11.0) (7.0)
Requirement already satisfied: zeroconf>=0.24.2 in /usr/local/lib/python3.7/site-packages (from opendrop==0.11.0) (0.24.5)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.7/site-packages (from requests->opendrop==0.11.0) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.7/site-packages (from requests->opendrop==0.11.0) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/site-packages (from requests->opendrop==0.11.0) (2019.6.16)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/site-packages (from requests->opendrop==0.11.0) (1.25.8)
Building wheels for collected packages: opendrop
  Building wheel for opendrop (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3_/vxcr03h12317925whg6vnfth0000gr/T/pip-req-build-pt2neggd/setup.py'"'"'; __file__='"'"'/private/var/folders/3_/vxcr03h12317925whg6vnfth0000gr/T/pip-req-build-pt2neggd/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/3_/vxcr03h12317925whg6vnfth0000gr/T/pip-wheel-txvjww_a
       cwd: /private/var/folders/3_/vxcr03h12317925whg6vnfth0000gr/T/pip-req-build-pt2neggd/
  Complete output (69 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib
  creating build/lib/opendrop
  copying src/opendrop/server.py -> build/lib/opendrop
  copying src/opendrop/config.py -> build/lib/opendrop
  copying src/opendrop/util.py -> build/lib/opendrop
  copying src/opendrop/client.py -> build/lib/opendrop
  copying src/opendrop/__init__.py -> build/lib/opendrop
  copying src/opendrop/cli.py -> build/lib/opendrop
  copying src/opendrop/__main__.py -> build/lib/opendrop
  running egg_info
  creating src/opendrop.egg-info
  writing src/opendrop.egg-info/PKG-INFO
  writing dependency_links to src/opendrop.egg-info/dependency_links.txt
  writing entry points to src/opendrop.egg-info/entry_points.txt
  writing requirements to src/opendrop.egg-info/requires.txt
  writing top-level names to src/opendrop.egg-info/top_level.txt
  writing manifest file 'src/opendrop.egg-info/SOURCES.txt'
  reading manifest file 'src/opendrop.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files found matching '.gitignore'
  no previously-included directories found matching '.cache'
  no previously-included directories found matching '.git'
  no previously-included directories found matching 'build'
  no previously-included directories found matching 'dist'
  warning: no previously-included files matching '*' found under directory '*.egg-info'
  writing manifest file 'src/opendrop.egg-info/SOURCES.txt'
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/3_/vxcr03h12317925whg6vnfth0000gr/T/pip-req-build-pt2neggd/setup.py", line 8, in <module>
      setuptools.setup()
    File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 144, in setup
      return distutils.core.setup(**attrs)
    File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 223, in run
      self.run_command('build')
    File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.7/site-packages/setuptools/command/build_py.py", line 53, in run
      self.build_package_data()
    File "/usr/local/lib/python3.7/site-packages/setuptools/command/build_py.py", line 118, in build_package_data
      for package, src_dir, build_dir, filenames in self.data_files:
    File "/usr/local/lib/python3.7/site-packages/setuptools/command/build_py.py", line 66, in __getattr__
      self.data_files = self._get_data_files()
    File "/usr/local/lib/python3.7/site-packages/setuptools/command/build_py.py", line 83, in _get_data_files
      return list(map(self._get_pkg_data_files, self.packages or ()))
    File "/usr/local/lib/python3.7/site-packages/setuptools/command/build_py.py", line 95, in _get_pkg_data_files
      for file in self.find_data_files(package, src_dir)
    File "/usr/local/lib/python3.7/site-packages/setuptools/command/build_py.py", line 104, in find_data_files
      src_dir,
    File "/usr/local/lib/python3.7/site-packages/setuptools/command/build_py.py", line 228, in _get_platform_patterns
      spec.get('', []),
  AttributeError: 'str' object has no attribute 'get'
  ----------------------------------------
  ERROR: Failed building wheel for opendrop
vinaysb commented 4 years ago

@Sn0wfreezeDev Yes I made a mistake with the config file. I added the package data in a wrong manner. I have now fixed that, it seems to be working right now

Sn0wfreezeDev commented 4 years ago

Hi @vinaysb is it possible that you keep the changes more minimal? After some research we could not find recommendations that the source should be located in a src folder for python projects. Actually we discovered several projects that have a similar structure to the current one.

Furthermore, there are some parts in the setup.cfg file that may be unnecessary:

And it contains several FIXMEs so maybe we could just change the setup.cfg to be as close to the setup.py as possible.

Kind regards Alex

schmittner commented 3 years ago

Closing this as stale.