Ronny Pfannschmidt avatar Ronny Pfannschmidt committed 5062e19

add build command

Comments (0)

Files changed (2)

pu/tasks/build.py

 
 
 class CopyScripts(TaskBase):
+    #XXX: fix shebangs
     keys = 'source', 'build_scripts'
     scripts = None
     requirements = ReadYamlMetadata,
             #XXX: better error
             assert script.check(file=1), 'script %s missing'%script
             script.copy(target=self.build_scripts.join(script.basename))
+
+
+class Build(TaskBase):
+    keys = 'source', 'build_scripts', 'build_lib'
+    requirements = CopyScripts, CompileByteCode, CopyScripts
+
+    def __call__(self):
+        pass

tests/tasks/test_build.py

-from pu.tasks.build import CopyPackagesToBuild, CompileByteCode, CopyScripts
+from pu.tasks.build import CopyPackagesToBuild, CompileByteCode, \
+        CopyScripts, Build
 from pu.task_queue import Queue
 
 
     assert len(build_scripts.listdir()) == 2
 
 
+def test_build_(source, tmpdir):
+    source.join('kij.yml').write(
+            'name: test\n'
+            'scripts: [foo, bin/bar]\n'
+            'packages: [testpkg]\n'
+            )
+    source.ensure('foo')
+    source.ensure('bin/bar')
+    source.ensure('testpkg/__init__.py')
 
+    task = Build(
+        source=source,
+        build_scripts=tmpdir.join('scripts'),
+        build_lib=tmpdir.join('lib'),
+        )
 
+    queue = Queue()
+    queue.add(task)
+    queue.run_all()
+    assert len(tmpdir.join('scripts').listdir()) == 2
+    assert tmpdir.join('lib/testpkg/__init__.py').check()
+    assert tmpdir.join('lib/testpkg/__init__.pyc').check()
+
+
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.