<pre style='margin:0'>
Cyril Roelandt (Steap) pushed a commit to branch master
in repository upt-macports.
</pre>
<p><a href="https://github.com/macports/upt-macports/commit/32e67bd7ed727a28f89d9bb992cec3d0e71932e3">https://github.com/macports/upt-macports/commit/32e67bd7ed727a28f89d9bb992cec3d0e71932e3</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 32e67bd Not scanning for frontend when creating output dir
</span>32e67bd is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 32e67bd7ed727a28f89d9bb992cec3d0e71932e3
</span>Author: Korusuke <karan.sheth@somaiya.edu>
AuthorDate: Sat Jul 20 02:56:47 2019 +0530
<span style='display:block; white-space:pre;color:#404040;'> Not scanning for frontend when creating output dir
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Fixes #41
</span>---
upt_macports/tests/test_macports_package.py | 7 +------
upt_macports/upt_macports.py | 15 ++++-----------
2 files changed, 5 insertions(+), 17 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/upt_macports/tests/test_macports_package.py b/upt_macports/tests/test_macports_package.py
</span><span style='display:block; white-space:pre;color:#808080;'>index 3a92086..814bac4 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/upt_macports/tests/test_macports_package.py
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/upt_macports/tests/test_macports_package.py
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -78,12 +78,7 @@ class TestDirectoryCreation(unittest.TestCase):
</span> self.package = MacPortsPackage()
self.package.upt_pkg = upt.Package('foo', '42')
self.package.upt_pkg.frontend = 'pypi'
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- def test_create_directories_output_invalid_frontend(self):
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- self.package.upt_pkg.frontend = 'frontend'
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- with self.assertRaises(SystemExit):
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- self.package._create_output_directories(self.package.upt_pkg,
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- '/ports/')
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ self.package.category = 'python'
</span>
@mock.patch('os.makedirs')
@mock.patch.object(MacPortsPackage, '_normalized_macports_folder',
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/upt_macports/upt_macports.py b/upt_macports/upt_macports.py
</span><span style='display:block; white-space:pre;color:#808080;'>index f15272c..523b567 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/upt_macports/upt_macports.py
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/upt_macports/upt_macports.py
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -24,19 +24,9 @@ class MacPortsPackage(object):
</span> def _create_output_directories(self, upt_pkg, output_dir):
"""Creates the directory layout required"""
self.logger.info(f'Creating the directory structure in {output_dir}')
<span style='display:block; white-space:pre;background:#ffe0e0;'>- upt2macports = {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 'cpan': 'perl',
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 'pypi': 'python',
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- 'rubygems': 'ruby',
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- try:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- port_category = upt2macports[self.upt_pkg.frontend]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- except KeyError:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- sys.exit(
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- f'Unknown port category for frontend {self.upt_pkg.frontend}')
</span> folder_name = self._normalized_macports_folder(upt_pkg.name)
self.output_dir = os.path.join(
<span style='display:block; white-space:pre;background:#ffe0e0;'>- output_dir, port_category, folder_name)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ output_dir, self.category, folder_name)
</span> try:
os.makedirs(self.output_dir, exist_ok=True)
self.logger.info(f'Created {self.output_dir}')
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -130,6 +120,7 @@ class MacPortsPackage(object):
</span> class MacPortsPythonPackage(MacPortsPackage):
template = 'python.Portfile'
archive_format = upt.ArchiveType.SOURCE_TARGZ
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ category = 'python'
</span>
def _pkgname(self):
macports_name = self._normalized_macports_name(self.upt_pkg.name)
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -170,6 +161,7 @@ class MacPortsNpmPackage(MacPortsPackage):
</span> class MacPortsPerlPackage(MacPortsPackage):
template = 'perl.Portfile'
archive_format = upt.ArchiveType.SOURCE_TARGZ
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ category = 'perl'
</span>
def _pkgname(self):
macports_name = self._normalized_macports_name(self.upt_pkg.name)
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -215,6 +207,7 @@ class MacPortsPerlPackage(MacPortsPackage):
</span> class MacPortsRubyPackage(MacPortsPackage):
template = 'ruby.Portfile'
archive_format = upt.ArchiveType.RUBYGEM
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ category = 'ruby'
</span>
def _pkgname(self):
macports_name = self._normalized_macports_name(self.upt_pkg.name)
</pre><pre style='margin:0'>
</pre>