Cross package maker. DEB/RPM generation or conversion. Derived from jordansissel/fpm.

⌈⌋ ⎇ branch:  cross package maker


Check-in [e3238acf20]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge pull request #461 from r4um/pr_452 python: handle == dependency requirement correctly
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e3238acf206edc6486ea6f2653384cc1fb75def7
User & Date: jls@semicomplete.com 2013-06-05 07:22:34
Context
2013-06-12
21:22
- actually respect the compression flag (instead of failing) Reported by George Reilly on the mailing list. check-in: d2c773aeea user: jls@semicomplete.com tags: trunk
2013-06-07
17:15
fix custom channel discovery check-in: 9723f191f1 user: zsolt@takacs.cc tags: trunk
2013-06-05
23:17
Fix stat when using -rpm-use-file-permissions: Strip leading slash from file pathname before call to stat, otherwise the correct file permissions will not be computed. check-in: e907f8cbab user: rhorwood@apple.com tags: trunk
07:22
Merge pull request #461 from r4um/pr_452 python: handle == dependency requirement correctly check-in: e3238acf20 user: jls@semicomplete.com tags: trunk
07:21
Merge pull request #462 from tristanls/string-has-no-fetch npm package.json author can be a string check-in: 39570ab301 user: jls@semicomplete.com tags: trunk
2013-05-30
05:44
python: handle == dependency requirement correctly check-in: 6217942711 user: pranay.kanwar@gmail.com tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/fpm/package/pyfpm/get_metadata.py.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
        if self.load_requirements_txt:
            self.load_requirements_txt = os.path.exists(self.requirements_txt)

    def process_dep(self, dep):
        deps = []
        if dep.specs:
            for operator, version in dep.specs:
                final_operator = operator

                if operator == "==":
                    final_operator = "="

                deps.append("%s %s %s" % (dep.project_name,
                    final_operator, version))
        else:
            deps.append(dep.project_name)

        return deps

    def run(self):
        data = {







<
<
<
<
<

|







31
32
33
34
35
36
37





38
39
40
41
42
43
44
45
46
        if self.load_requirements_txt:
            self.load_requirements_txt = os.path.exists(self.requirements_txt)

    def process_dep(self, dep):
        deps = []
        if dep.specs:
            for operator, version in dep.specs:





                deps.append("%s %s %s" % (dep.project_name,
                        operator, version))
        else:
            deps.append(dep.project_name)

        return deps

    def run(self):
        data = {

Changes to lib/fpm/package/python.rb.

196
197
198
199
200
201
202







203
204
205
206
207
208
209
        dep_re = /^([^<>!= ]+)\s*(?:([<>!=]{1,2})\s*(.*))?$/
        match = dep_re.match(dep)
        if match.nil?
          @logger.error("Unable to parse dependency", :dependency => dep)
          raise FPM::InvalidPackageConfiguration, "Invalid dependency '#{dep}'"
        end
        name, cmp, version = match.captures







        # dependency name prefixing is optional, if enabled, a name 'foo' will
        # become 'python-foo' (depending on what the python_package_name_prefix
        # is)
        name = fix_name(name) if attributes[:python_fix_dependencies?]

        # convert dependencies from python-Foo to python-foo
        name = name.downcase if attributes[:python_downcase_dependencies?]







>
>
>
>
>
>
>







196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
        dep_re = /^([^<>!= ]+)\s*(?:([<>!=]{1,2})\s*(.*))?$/
        match = dep_re.match(dep)
        if match.nil?
          @logger.error("Unable to parse dependency", :dependency => dep)
          raise FPM::InvalidPackageConfiguration, "Invalid dependency '#{dep}'"
        end
        name, cmp, version = match.captures

        # convert == to =
        if cmp == "=="
          @logger.info("Converting == dependency requirement to =", :dependency => dep )
          cmp = "="
        end

        # dependency name prefixing is optional, if enabled, a name 'foo' will
        # become 'python-foo' (depending on what the python_package_name_prefix
        # is)
        name = fix_name(name) if attributes[:python_fix_dependencies?]

        # convert dependencies from python-Foo to python-foo
        name = name.downcase if attributes[:python_downcase_dependencies?]

Added spec/fixtures/python/requirements.txt.





>
>
1
2
rtxt-dep1 > 0.1
rtxt-dep2 == 0.1

Changes to spec/fpm/package/python_spec.rb.

65
66
67
68
69
70
71












72

      it "it should not prefix the name at all" do
        subject.input(example_dir)
        insist { subject.name } == "example"
      end
    end
  end












end # describe FPM::Package::Python







>
>
>
>
>
>
>
>
>
>
>
>

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

      it "it should not prefix the name at all" do
        subject.input(example_dir)
        insist { subject.name } == "example"
      end
    end
  end

  context "when python_obey_requirements_txt? is true" do
    before :each do
      subject.attributes[:python_obey_requirements_txt?] = true
      subject.attributes[:python_dependencies?] = true
    end

    it "it should load requirements.txt" do
      subject.input(example_dir)
      insist { subject.dependencies.sort } == ["rtxt-dep1 > 0.1", "rtxt-dep2 = 0.1"]
     end
  end
end # describe FPM::Package::Python